| 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 #include "bin/dbg_message.h" | 6 #include "bin/dbg_message.h" |
| 7 #include "bin/dartutils.h" | 7 #include "bin/dartutils.h" |
| 8 #include "bin/lockers.h" | 8 #include "bin/lockers.h" |
| 9 #include "bin/log.h" | 9 #include "bin/log.h" |
| 10 #include "bin/socket.h" | 10 #include "bin/socket.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 FATAL("Failed initializing socket implementation."); | 321 FATAL("Failed initializing socket implementation."); |
| 322 } | 322 } |
| 323 | 323 |
| 324 // Now setup a listener socket and start a thread which will | 324 // Now setup a listener socket and start a thread which will |
| 325 // listen, accept connections from debuggers, read and handle/dispatch | 325 // listen, accept connections from debuggers, read and handle/dispatch |
| 326 // debugger commands received on these connections. | 326 // debugger commands received on these connections. |
| 327 ASSERT(listener_fd_ == -1); | 327 ASSERT(listener_fd_ == -1); |
| 328 OSError *os_error; | 328 OSError *os_error; |
| 329 AddressList<SocketAddress>* addresses = | 329 AddressList<SocketAddress>* addresses = |
| 330 Socket::LookupAddress(address, -1, &os_error); | 330 Socket::LookupAddress(address, -1, &os_error); |
| 331 listener_fd_ = ServerSocket::CreateBindListen( | 331 RawAddr addr = addresses->GetAt(0)->addr(); |
| 332 addresses->GetAt(0)->addr(), port_number, 1); | 332 SocketAddress::SetAddrPort(&addr, port_number); |
| 333 listener_fd_ = ServerSocket::CreateBindListen(addr, 1); |
| 333 delete addresses; | 334 delete addresses; |
| 334 if (listener_fd_ < 0) { | 335 if (listener_fd_ < 0) { |
| 335 fprintf(stderr, "%s", "Could not initialize debug socket\n"); | 336 fprintf(stderr, "%s", "Could not initialize debug socket\n"); |
| 336 fflush(stderr); | 337 fflush(stderr); |
| 337 exit(255); | 338 exit(255); |
| 338 } | 339 } |
| 339 | 340 |
| 340 port_number = Socket::GetPort(listener_fd_); | 341 port_number = Socket::GetPort(listener_fd_); |
| 341 DebuggerConnectionImpl::StartHandler(port_number); | 342 DebuggerConnectionImpl::StartHandler(port_number); |
| 342 return port_number; | 343 return port_number; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 507 |
| 507 | 508 |
| 508 bool DebuggerConnectionHandler::IsConnected() { | 509 bool DebuggerConnectionHandler::IsConnected() { |
| 509 // TODO(asiva): Support multiple debugger connections. | 510 // TODO(asiva): Support multiple debugger connections. |
| 510 // Return true if a connection has been established. | 511 // Return true if a connection has been established. |
| 511 return singleton_handler != NULL; | 512 return singleton_handler != NULL; |
| 512 } | 513 } |
| 513 | 514 |
| 514 } // namespace bin | 515 } // namespace bin |
| 515 } // namespace dart | 516 } // namespace dart |
| OLD | NEW |