Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: runtime/bin/socket_macos.cc

Issue 2210523002: Revert "Better error-message when bind fails." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if !defined(DART_IO_DISABLED) 5 #if !defined(DART_IO_DISABLED)
6 6
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #if defined(TARGET_OS_MACOS) 8 #if defined(TARGET_OS_MACOS)
9 9
10 #include "bin/socket.h" 10 #include "bin/socket.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr))); 96 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr)));
97 if ((result != 0) && (errno != EINPROGRESS)) { 97 if ((result != 0) && (errno != EINPROGRESS)) {
98 VOID_TEMP_FAILURE_RETRY(close(fd)); 98 VOID_TEMP_FAILURE_RETRY(close(fd));
99 return -1; 99 return -1;
100 } 100 }
101 101
102 return Connect(fd, addr); 102 return Connect(fd, addr);
103 } 103 }
104 104
105 105
106 bool Socket::IsBindError(intptr_t error_number) {
107 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
108 error_number == EINVAL;
109 }
110
111
112 intptr_t Socket::Available(intptr_t fd) { 106 intptr_t Socket::Available(intptr_t fd) {
113 return FDUtils::AvailableBytes(fd); 107 return FDUtils::AvailableBytes(fd);
114 } 108 }
115 109
116 110
117 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { 111 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) {
118 ASSERT(fd >= 0); 112 ASSERT(fd >= 0);
119 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes)); 113 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes));
120 ASSERT(EAGAIN == EWOULDBLOCK); 114 ASSERT(EAGAIN == EWOULDBLOCK);
121 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { 115 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) {
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 int interfaceIndex) { 625 int interfaceIndex) {
632 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false); 626 return JoinOrLeaveMulticast(fd, addr, interface, interfaceIndex, false);
633 } 627 }
634 628
635 } // namespace bin 629 } // namespace bin
636 } // namespace dart 630 } // namespace dart
637 631
638 #endif // defined(TARGET_OS_MACOS) 632 #endif // defined(TARGET_OS_MACOS)
639 633
640 #endif // !defined(DART_IO_DISABLED) 634 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/socket_linux.cc ('k') | runtime/bin/socket_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698