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 status;
do
status = send(socket_, data, len, 0);
while (status == -1 && errno == EINTR);
int written;
for (written = 0; written < len; /* empty */) {
int status = send(socket_, data + written, len - written, 0);
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