| 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 "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_ANDROID) | 6 #if defined(TARGET_OS_ANDROID) |
| 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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 | 184 |
| 185 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { | 185 SocketAddress* Socket::GetRemotePeer(intptr_t fd, intptr_t* port) { |
| 186 ASSERT(fd >= 0); | 186 ASSERT(fd >= 0); |
| 187 RawAddr raw; | 187 RawAddr raw; |
| 188 socklen_t size = sizeof(raw); | 188 socklen_t size = sizeof(raw); |
| 189 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( | 189 if (TEMP_FAILURE_RETRY_BLOCK_SIGNALS( |
| 190 getpeername(fd, | 190 getpeername(fd, |
| 191 &raw.addr, | 191 &raw.addr, |
| 192 &size))) { | 192 &size))) { |
| 193 const int kBufferSize = 1024; | |
| 194 char error_message[kBufferSize]; | |
| 195 strerror_r(errno, error_message, kBufferSize); | |
| 196 Log::PrintErr("Error getpeername: %s\n", error_message); | |
| 197 return NULL; | 193 return NULL; |
| 198 } | 194 } |
| 199 *port = SocketAddress::GetAddrPort(&raw); | 195 *port = SocketAddress::GetAddrPort(&raw); |
| 200 return new SocketAddress(&raw.addr); | 196 return new SocketAddress(&raw.addr); |
| 201 } | 197 } |
| 202 | 198 |
| 203 | 199 |
| 204 void Socket::GetError(intptr_t fd, OSError* os_error) { | 200 void Socket::GetError(intptr_t fd, OSError* os_error) { |
| 205 int errorNumber; | 201 int errorNumber; |
| 206 socklen_t len = sizeof(errorNumber); | 202 socklen_t len = sizeof(errorNumber); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 mreq.gr_interface = interfaceIndex; | 572 mreq.gr_interface = interfaceIndex; |
| 577 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); | 573 memmove(&mreq.gr_group, &addr->ss, SocketAddress::GetAddrLength(addr)); |
| 578 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt( | 574 return TEMP_FAILURE_RETRY_BLOCK_SIGNALS(setsockopt( |
| 579 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; | 575 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; |
| 580 } | 576 } |
| 581 | 577 |
| 582 } // namespace bin | 578 } // namespace bin |
| 583 } // namespace dart | 579 } // namespace dart |
| 584 | 580 |
| 585 #endif // defined(TARGET_OS_ANDROID) | 581 #endif // defined(TARGET_OS_ANDROID) |
| OLD | NEW |