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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) { | 406 if (NO_RETRY_EXPECTED(listen(fd, backlog > 0 ? backlog : SOMAXCONN)) != 0) { |
407 VOID_TEMP_FAILURE_RETRY(close(fd)); | 407 VOID_TEMP_FAILURE_RETRY(close(fd)); |
408 return -1; | 408 return -1; |
409 } | 409 } |
410 | 410 |
411 Socket::SetNonBlocking(fd); | 411 Socket::SetNonBlocking(fd); |
412 return fd; | 412 return fd; |
413 } | 413 } |
414 | 414 |
415 | 415 |
| 416 bool ServerSocket::StartAccept(intptr_t fd) { |
| 417 USE(fd); |
| 418 return true; |
| 419 } |
| 420 |
| 421 |
416 intptr_t ServerSocket::Accept(intptr_t fd) { | 422 intptr_t ServerSocket::Accept(intptr_t fd) { |
417 intptr_t socket; | 423 intptr_t socket; |
418 struct sockaddr clientaddr; | 424 struct sockaddr clientaddr; |
419 socklen_t addrlen = sizeof(clientaddr); | 425 socklen_t addrlen = sizeof(clientaddr); |
420 socket = TEMP_FAILURE_RETRY(accept(fd, &clientaddr, &addrlen)); | 426 socket = TEMP_FAILURE_RETRY(accept(fd, &clientaddr, &addrlen)); |
421 if (socket == -1) { | 427 if (socket == -1) { |
422 if (errno == EAGAIN) { | 428 if (errno == EAGAIN) { |
423 // We need to signal to the caller that this is actually not an | 429 // We need to signal to the caller that this is actually not an |
424 // error. We got woken up from the poll on the listening socket, | 430 // error. We got woken up from the poll on the listening socket, |
425 // but there is no connection ready to be accepted. | 431 // but there is no connection ready to be accepted. |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 619 |
614 bool Socket::LeaveMulticast( | 620 bool Socket::LeaveMulticast( |
615 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { | 621 intptr_t fd, RawAddr* addr, RawAddr* interface, int interfaceIndex) { |
616 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); | 622 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); |
617 } | 623 } |
618 | 624 |
619 } // namespace bin | 625 } // namespace bin |
620 } // namespace dart | 626 } // namespace dart |
621 | 627 |
622 #endif // defined(TARGET_OS_MACOS) | 628 #endif // defined(TARGET_OS_MACOS) |
OLD | NEW |