Browse Source

v8: posix: try to send() whole buffer

Retry the send() syscall after a partial write.
v0.9.1-release
Ben Noordhuis 13 years ago
parent
commit
48cdbffd24
  1. 21
      deps/v8/src/platform-posix.cc

21
deps/v8/src/platform-posix.cc

@ -472,13 +472,22 @@ bool POSIXSocket::Shutdown() {
int POSIXSocket::Send(const char* data, int len) const { int POSIXSocket::Send(const char* data, int len) const {
int status; int written;
do for (written = 0; written < len; /* empty */) {
status = send(socket_, data, len, 0); int status = send(socket_, data + written, len - written, 0);
while (status == -1 && errno == EINTR); if (status == 0) {
break;
} else if (status > 0) {
written += status;
} else if (errno == EINTR) {
/* interrupted by signal, retry */
} else {
return -1;
}
}
return status; return written;
} }

Loading…
Cancel
Save