diff --git a/deps/v8/src/platform-posix.cc b/deps/v8/src/platform-posix.cc index 9c574937b3..1f87e70972 100644 --- a/deps/v8/src/platform-posix.cc +++ b/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; }