summaryrefslogtreecommitdiff
path: root/deps/v8/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2012-04-24 03:45:30 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-04-24 04:11:22 +0200
commitebfb8a5613b2e7f5961644cc24ca023d2ca73255 (patch)
tree26ae0df2d4857a85e757a09897a62372e1e135dc /deps/v8/src
parent4359e8154d418d7fa048a38b2415a94364ffb093 (diff)
downloadnode-new-ebfb8a5613b2e7f5961644cc24ca023d2ca73255.tar.gz
v8: posix: handle EINTR in socket functions
The socket functions did not handle EINTR (syscall interrupted by signal) which tripped up the debug agent.
Diffstat (limited to 'deps/v8/src')
-rw-r--r--deps/v8/src/platform-posix.cc25
1 files changed, 21 insertions, 4 deletions
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;
}