| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "bin/dbg_connection.h" | 5 #include "bin/dbg_connection.h" |
| 6 | 6 |
| 7 void DebuggerConnectionImpl::StartHandler(int port_number) { | 7 #include "bin/eventhandler.h" |
| 8 FATAL("Debugger wire protocol not yet implemented on Linux\n"); | 8 |
| 9 void DebuggerConnectionImpl::ThreadEntry(uword args) { |
| 10 ListenSocket* listen_socket = |
| 11 reinterpret_cast<ListenSocket*>(DebuggerConnectionHandler::listener_fd_); |
| 12 SOCKET client_socket = accept(listen_socket->socket(), NULL, NULL); |
| 13 if (client_socket == INVALID_SOCKET) { |
| 14 FATAL("Accepting new debugger connection failed.\n"); |
| 15 } |
| 16 ClientSocket* socket = new ClientSocket(client_socket); |
| 17 DebuggerConnectionHandler::AcceptDbgConnection(reinterpret_cast<int>(socket)); |
| 9 } | 18 } |
| 10 | 19 |
| 20 |
| 21 void DebuggerConnectionImpl::StartHandler(int port_number) { |
| 22 ASSERT(DebuggerConnectionHandler::listener_fd_ != -1); |
| 23 int result = dart::Thread::Start(&DebuggerConnectionImpl::ThreadEntry, 0); |
| 24 if (result != 0) { |
| 25 FATAL1("Failed to start debugger connection handler thread: %d\n", result); |
| 26 } |
| 27 } |
| 28 |
| 29 |
| 30 intptr_t DebuggerConnectionImpl::Send(intptr_t socket, |
| 31 const char* buf, |
| 32 int len) { |
| 33 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(socket); |
| 34 return send(client_socket->socket(), buf, len, 0); |
| 35 } |
| 36 |
| 37 |
| 38 intptr_t DebuggerConnectionImpl::Receive(intptr_t socket, char* buf, int len) { |
| 39 ClientSocket* client_socket = reinterpret_cast<ClientSocket*>(socket); |
| 40 return recv(client_socket->socket(), buf, len, 0); |
| 41 } |
| OLD | NEW |