Patches floating on V8
This commit is contained in:
Родитель
3f3f958c14
Коммит
2cca7488bf
|
@ -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' ],
|
||||
}],
|
||||
],
|
||||
|
@ -386,7 +386,6 @@
|
|||
}], # OS=="mac"
|
||||
['OS=="win"', {
|
||||
'msvs_configuration_attributes': {
|
||||
'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)',
|
||||
'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
|
||||
'CharacterSet': '1',
|
||||
},
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче