| 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include <errno.h> // NOLINT | 8 #include <errno.h> // NOLINT |
| 9 #include <stdio.h> // NOLINT | 9 #include <stdio.h> // NOLINT |
| 10 #include <stdlib.h> // NOLINT | 10 #include <stdlib.h> // NOLINT |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 185 |
| 186 | 186 |
| 187 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { | 187 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { |
| 188 ASSERT(fd >= 0); | 188 ASSERT(fd >= 0); |
| 189 RawAddr raw; | 189 RawAddr raw; |
| 190 socklen_t size = sizeof(raw); | 190 socklen_t size = sizeof(raw); |
| 191 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( | 191 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( |
| 192 getpeername(fd, | 192 getpeername(fd, |
| 193 &raw.addr, | 193 &raw.addr, |
| 194 &size))) { | 194 &size))) { |
| 195 const int kBufferSize = 1024; | |
| 196 char error_message[kBufferSize]; | |
| 197 strerror_r(errno, error_message, kBufferSize); | |
| 198 Log::PrintErr("Error getpeername: %s\n", error_message); | |
| 199 return NULL; | 195 return NULL; |
| 200 } | 196 } |
| 201 *port = SocketAddress::GetAddrPort(&raw); | 197 *port = SocketAddress::GetAddrPort(&raw); |
| 202 return new SocketAddress(&raw.addr); | 198 return new SocketAddress(&raw.addr); |
| 203 } | 199 } |
| 204 | 200 |
| 205 | 201 |
| 206 void Socket::GetError(intptr_t fd, OSError* os_error) { | 202 void Socket::GetError(intptr_t fd, OSError* os_error) { |
| 207 int len = sizeof(errno); | 203 int len = sizeof(errno); |
| 208 getsockopt(fd, | 204 getsockopt(fd, |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 633 |
| 638 bool Socket::LeaveMulticast( | 634 bool Socket::LeaveMulticast( |
| 639 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { | 635 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { |
| 640 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 636 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
| 641 } | 637 } |
| 642 | 638 |
| 643 } // namespace bin | 639 } // namespace bin |
| 644 } // namespace dart | 640 } // namespace dart |
| 645 | 641 |
| 646 #endif // defined(TARGET_OS_MACOS) | 642 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |