summaryrefslogtreecommitdiff
path: root/deps/v8/src
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-05-16 08:50:24 -0700
committerisaacs <i@izs.me>2012-05-16 14:22:57 -0700
commit2cca7488bf5f783c0b7a2c1258baa583a771164a (patch)
tree39fbb9c921891781d8634975166b89a1aff70368 /deps/v8/src
parent3f3f958c14cf4e963a73d6f037ac381c77fe78bb (diff)
downloadnode-new-2cca7488bf5f783c0b7a2c1258baa583a771164a.tar.gz
Patches floating on V8
Diffstat (limited to 'deps/v8/src')
-rw-r--r--deps/v8/src/debug-agent.cc26
-rw-r--r--deps/v8/src/platform-posix.cc36
2 files changed, 44 insertions, 18 deletions
diff --git a/deps/v8/src/debug-agent.cc b/deps/v8/src/debug-agent.cc
index 511663d8ee..bdc7a578ac 100644
--- a/deps/v8/src/debug-agent.cc
+++ b/deps/v8/src/debug-agent.cc
@@ -323,41 +323,41 @@ bool DebuggerAgentUtil::SendConnectMessage(const Socket* conn,
const char* embedding_host) {
static const int kBufferSize = 80;
char buffer[kBufferSize]; // Sending buffer.
- bool ok;
int len;
+ int r;
// Send the header.
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize),
"Type: connect\r\n");
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize),
"V8-Version: %s\r\n", v8::V8::GetVersion());
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize),
"Protocol-Version: 1\r\n");
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
if (embedding_host != NULL) {
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize),
"Embedding-Host: %s\r\n", embedding_host);
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
}
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize),
"%s: 0\r\n", kContentLength);
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
// Terminate header with empty line.
len = OS::SNPrintF(Vector<char>(buffer, kBufferSize), "\r\n");
- ok = conn->Send(buffer, len);
- if (!ok) return false;
+ r = conn->Send(buffer, len);
+ if (r != len) return false;
// No body for connect message.
diff --git a/deps/v8/src/platform-posix.cc b/deps/v8/src/platform-posix.cc
index 66316594c8..224001d753 100644
--- a/deps/v8/src/platform-posix.cc
+++ b/deps/v8/src/platform-posix.cc
@@ -421,7 +421,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 {
@@ -448,7 +452,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;
}
@@ -467,13 +474,32 @@ bool POSIXSocket::Shutdown() {
int POSIXSocket::Send(const char* data, int len) const {
- int status = send(socket_, data, len, 0);
- return status;
+ 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 written;
}
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;
}