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

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

Issue 2213533002: Enter a description of the change. (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.cc ('k') | runtime/bin/socket_fuchsia.cc » ('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) 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 #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_ANDROID) 8 #if defined(TARGET_OS_ANDROID)
9 9
10 #include "bin/socket.h" 10 #include "bin/socket.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr))); 94 bind(fd, &source_addr.addr, SocketAddress::GetAddrLength(source_addr)));
95 if ((result != 0) && (errno != EINPROGRESS)) { 95 if ((result != 0) && (errno != EINPROGRESS)) {
96 VOID_TEMP_FAILURE_RETRY(close(fd)); 96 VOID_TEMP_FAILURE_RETRY(close(fd));
97 return -1; 97 return -1;
98 } 98 }
99 99
100 return Connect(fd, addr); 100 return Connect(fd, addr);
101 } 101 }
102 102
103 103
104 bool Socket::IsBindError(intptr_t error_number) {
105 return error_number == EADDRINUSE || error_number == EADDRNOTAVAIL ||
106 error_number == EINVAL;
107 }
108
109
110 intptr_t Socket::Available(intptr_t fd) { 104 intptr_t Socket::Available(intptr_t fd) {
111 return FDUtils::AvailableBytes(fd); 105 return FDUtils::AvailableBytes(fd);
112 } 106 }
113 107
114 108
115 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) { 109 intptr_t Socket::Read(intptr_t fd, void* buffer, intptr_t num_bytes) {
116 ASSERT(fd >= 0); 110 ASSERT(fd >= 0);
117 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes)); 111 ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes));
118 ASSERT(EAGAIN == EWOULDBLOCK); 112 ASSERT(EAGAIN == EWOULDBLOCK);
119 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) { 113 if ((read_bytes == -1) && (errno == EWOULDBLOCK)) {
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return NO_RETRY_EXPECTED(setsockopt( 576 return NO_RETRY_EXPECTED(setsockopt(
583 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0; 577 fd, proto, MCAST_LEAVE_GROUP, &mreq, sizeof(mreq))) == 0;
584 } 578 }
585 579
586 } // namespace bin 580 } // namespace bin
587 } // namespace dart 581 } // namespace dart
588 582
589 #endif // defined(TARGET_OS_ANDROID) 583 #endif // defined(TARGET_OS_ANDROID)
590 584
591 #endif // !defined(DART_IO_DISABLED) 585 #endif // !defined(DART_IO_DISABLED)
OLDNEW
« no previous file with comments | « runtime/bin/socket.cc ('k') | runtime/bin/socket_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698