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

Unified Diff: runtime/bin/socket_base_macos.cc

Issue 2830273002: [dart:io][windows] Implements RawSynchronousSocket (Closed)
Patch Set: Fix Linux build Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/socket_base_linux.cc ('k') | runtime/bin/socket_base_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_base_macos.cc
diff --git a/runtime/bin/socket_base_macos.cc b/runtime/bin/socket_base_macos.cc
index b67d4efba1b06e4f56534e5f27724ce21583e34a..d8e423b408f06ef198d9f7bbd3f8715e3f045810 100644
--- a/runtime/bin/socket_base_macos.cc
+++ b/runtime/bin/socket_base_macos.cc
@@ -64,11 +64,14 @@ intptr_t SocketBase::Available(intptr_t fd) {
}
-intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes) {
+intptr_t SocketBase::Read(intptr_t fd,
+ void* buffer,
+ intptr_t num_bytes,
+ SocketOpKind sync) {
ASSERT(fd >= 0);
ssize_t read_bytes = TEMP_FAILURE_RETRY(read(fd, buffer, num_bytes));
ASSERT(EAGAIN == EWOULDBLOCK);
- if ((read_bytes == -1) && (errno == EWOULDBLOCK)) {
+ if ((sync == kAsync) && (read_bytes == -1) && (errno == EWOULDBLOCK)) {
// If the read would block we need to retry and therefore return 0
// as the number of bytes written.
read_bytes = 0;
@@ -80,12 +83,13 @@ intptr_t SocketBase::Read(intptr_t fd, void* buffer, intptr_t num_bytes) {
intptr_t SocketBase::RecvFrom(intptr_t fd,
void* buffer,
intptr_t num_bytes,
- RawAddr* addr) {
+ RawAddr* addr,
+ SocketOpKind sync) {
ASSERT(fd >= 0);
socklen_t addr_len = sizeof(addr->ss);
ssize_t read_bytes = TEMP_FAILURE_RETRY(
recvfrom(fd, buffer, num_bytes, 0, &addr->addr, &addr_len));
- if ((read_bytes == -1) && (errno == EWOULDBLOCK)) {
+ if ((sync == kAsync) && (read_bytes == -1) && (errno == EWOULDBLOCK)) {
// If the read would block we need to retry and therefore return 0
// as the number of bytes written.
read_bytes = 0;
@@ -96,11 +100,12 @@ intptr_t SocketBase::RecvFrom(intptr_t fd,
intptr_t SocketBase::Write(intptr_t fd,
const void* buffer,
- intptr_t num_bytes) {
+ intptr_t num_bytes,
+ SocketOpKind sync) {
ASSERT(fd >= 0);
ssize_t written_bytes = TEMP_FAILURE_RETRY(write(fd, buffer, num_bytes));
ASSERT(EAGAIN == EWOULDBLOCK);
- if ((written_bytes == -1) && (errno == EWOULDBLOCK)) {
+ if ((sync == kAsync) && (written_bytes == -1) && (errno == EWOULDBLOCK)) {
// If the would block we need to retry and therefore return 0 as
// the number of bytes written.
written_bytes = 0;
@@ -112,13 +117,14 @@ intptr_t SocketBase::Write(intptr_t fd,
intptr_t SocketBase::SendTo(intptr_t fd,
const void* buffer,
intptr_t num_bytes,
- const RawAddr& addr) {
+ const RawAddr& addr,
+ SocketOpKind sync) {
ASSERT(fd >= 0);
ssize_t written_bytes =
TEMP_FAILURE_RETRY(sendto(fd, buffer, num_bytes, 0, &addr.addr,
SocketAddress::GetAddrLength(addr)));
ASSERT(EAGAIN == EWOULDBLOCK);
- if ((written_bytes == -1) && (errno == EWOULDBLOCK)) {
+ if ((sync == kAsync) && (written_bytes == -1) && (errno == EWOULDBLOCK)) {
// If the would block we need to retry and therefore return 0 as
// the number of bytes written.
written_bytes = 0;
« no previous file with comments | « runtime/bin/socket_base_linux.cc ('k') | runtime/bin/socket_base_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698