diff --git a/deps/v8/src/platform-posix.cc b/deps/v8/src/platform-posix.cc index a729b66260..9c574937b3 100644 --- a/deps/v8/src/platform-posix.cc +++ b/deps/v8/src/platform-posix.cc @@ -419,7 +419,11 @@ Socket* POSIXSocket::Accept() const { return NULL; } - int socket = accept(socket_, NULL, NULL); + int socket; + do + socket = accept(socket_, NULL, NULL); + while (socket == -1 && errno == EINTR); + if (socket == -1) { return NULL; } else { @@ -446,7 +450,10 @@ bool POSIXSocket::Connect(const char* host, const char* port) { } // Connect. - status = connect(socket_, result->ai_addr, result->ai_addrlen); + do + status = connect(socket_, result->ai_addr, result->ai_addrlen); + while (status == -1 && errno == EINTR); + freeaddrinfo(result); return status == 0; } @@ -465,13 +472,23 @@ bool POSIXSocket::Shutdown() { int POSIXSocket::Send(const char* data, int len) const { - int status = send(socket_, data, len, 0); + int status; + + do + status = send(socket_, data, len, 0); + while (status == -1 && errno == EINTR); + return status; } int POSIXSocket::Receive(char* data, int len) const { - int status = recv(socket_, data, len, 0); + int status; + + do + status = recv(socket_, data, len, 0); + while (status == -1 && errno == EINTR); + return status; }