Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Patches floating on V8
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed May 16, 2012
1 parent 3f3f958 commit 2cca748
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 20 deletions.
3 changes: 1 addition & 2 deletions deps/v8/build/common.gypi
Expand Up @@ -339,7 +339,7 @@
'cflags': [ '-I/usr/pkg/include' ],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', {
'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter',
'cflags': [ '-Wno-unused-parameter',
'-Wnon-virtual-dtor', '-Woverloaded-virtual' ],
}],
],
Expand Down Expand Up @@ -386,7 +386,6 @@
}], # OS=="mac"
['OS=="win"', {
'msvs_configuration_attributes': {
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
'CharacterSet': '1',
},
Expand Down
26 changes: 13 additions & 13 deletions deps/v8/src/debug-agent.cc
Expand Up @@ -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.

Expand Down
36 changes: 31 additions & 5 deletions deps/v8/src/platform-posix.cc
Expand Up @@ -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 {
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 2cca748

Please sign in to comment.