Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/eventhandler.h" | 9 #include "bin/eventhandler.h" |
| 10 #include "bin/file.h" | 10 #include "bin/file.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 109 |
| 110 | 110 |
| 111 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { | 111 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { |
| 112 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket()); | 112 ASSERT(reinterpret_cast<Handle*>(fd)->is_socket()); |
| 113 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); | 113 SocketHandle* socket_handle = reinterpret_cast<SocketHandle*>(fd); |
| 114 RawAddr raw; | 114 RawAddr raw; |
| 115 socklen_t size = sizeof(raw); | 115 socklen_t size = sizeof(raw); |
| 116 if (getpeername(socket_handle->socket(), | 116 if (getpeername(socket_handle->socket(), |
| 117 &raw.addr, | 117 &raw.addr, |
| 118 &size)) { | 118 &size)) { |
| 119 Log::PrintErr("Error getpeername: %d\n", WSAGetLastError()); | |
|
Anders Johnsen
2014/02/19 16:14:34
Ty :)
| |
| 120 return NULL; | 119 return NULL; |
| 121 } | 120 } |
| 122 *port = SocketAddress::GetAddrPort(&raw); | 121 *port = SocketAddress::GetAddrPort(&raw); |
| 123 // Clear the port before calling WSAAddressToString as WSAAddressToString | 122 // Clear the port before calling WSAAddressToString as WSAAddressToString |
| 124 // includes the port in the formatted string. | 123 // includes the port in the formatted string. |
| 125 SocketAddress::SetAddrPort(&raw, 0); | 124 SocketAddress::SetAddrPort(&raw, 0); |
| 126 return new SocketAddress(&raw.addr); | 125 return new SocketAddress(&raw.addr); |
| 127 } | 126 } |
| 128 | 127 |
| 129 | 128 |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 636 proto, | 635 proto, |
| 637 MCAST_LEAVE_GROUP, | 636 MCAST_LEAVE_GROUP, |
| 638 reinterpret_cast<char *>(&mreq), | 637 reinterpret_cast<char *>(&mreq), |
| 639 sizeof(mreq)) == 0; | 638 sizeof(mreq)) == 0; |
| 640 } | 639 } |
| 641 | 640 |
| 642 } // namespace bin | 641 } // namespace bin |
| 643 } // namespace dart | 642 } // namespace dart |
| 644 | 643 |
| 645 #endif // defined(TARGET_OS_WINDOWS) | 644 #endif // defined(TARGET_OS_WINDOWS) |
| OLD | NEW |