deps: upgrade libuv to 7b66ea1
This commit is contained in:
parent
028c630ecd
commit
e99dff4617
6
deps/uv/include/uv.h
vendored
6
deps/uv/include/uv.h
vendored
@ -47,7 +47,7 @@ extern "C" {
|
||||
|
||||
|
||||
#define UV_VERSION_MAJOR 0
|
||||
#define UV_VERSION_MINOR 9
|
||||
#define UV_VERSION_MINOR 10
|
||||
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1600
|
||||
@ -660,12 +660,12 @@ UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle,
|
||||
unsigned int delay);
|
||||
|
||||
/*
|
||||
* This setting applies to Windows only.
|
||||
* Enable/disable simultaneous asynchronous accept requests that are
|
||||
* queued by the operating system when listening for new tcp connections.
|
||||
* This setting is used to tune a tcp server for the desired performance.
|
||||
* Having simultaneous accepts can significantly improve the rate of
|
||||
* accepting connections (which is why it is enabled by default).
|
||||
* accepting connections (which is why it is enabled by default) but
|
||||
* may lead to uneven load distribution in multi-process setups.
|
||||
*/
|
||||
UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
|
||||
|
||||
|
8
deps/uv/src/unix/tcp.c
vendored
8
deps/uv/src/unix/tcp.c
vendored
@ -343,11 +343,11 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) {
|
||||
}
|
||||
|
||||
|
||||
int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int on) {
|
||||
if (on)
|
||||
handle->flags |= UV_TCP_SINGLE_ACCEPT;
|
||||
else
|
||||
int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
|
||||
if (enable)
|
||||
handle->flags &= ~UV_TCP_SINGLE_ACCEPT;
|
||||
else
|
||||
handle->flags |= UV_TCP_SINGLE_ACCEPT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
43
deps/uv/src/unix/tty.c
vendored
43
deps/uv/src/unix/tty.c
vendored
@ -118,25 +118,52 @@ int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) {
|
||||
|
||||
|
||||
uv_handle_type uv_guess_handle(uv_file file) {
|
||||
struct sockaddr sa;
|
||||
struct stat s;
|
||||
socklen_t len;
|
||||
int type;
|
||||
|
||||
if (file < 0) {
|
||||
if (file < 0)
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
if (isatty(file)) {
|
||||
if (isatty(file))
|
||||
return UV_TTY;
|
||||
}
|
||||
|
||||
if (fstat(file, &s)) {
|
||||
if (fstat(file, &s))
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
if (!S_ISSOCK(s.st_mode) && !S_ISFIFO(s.st_mode)) {
|
||||
if (S_ISREG(s.st_mode))
|
||||
return UV_FILE;
|
||||
|
||||
if (S_ISCHR(s.st_mode))
|
||||
return UV_FILE; /* XXX UV_NAMED_PIPE? */
|
||||
|
||||
if (S_ISFIFO(s.st_mode))
|
||||
return UV_NAMED_PIPE;
|
||||
|
||||
if (!S_ISSOCK(s.st_mode))
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
|
||||
len = sizeof(type);
|
||||
if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len))
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
|
||||
len = sizeof(sa);
|
||||
if (getsockname(file, &sa, &len))
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
|
||||
if (type == SOCK_DGRAM)
|
||||
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
|
||||
return UV_UDP;
|
||||
|
||||
if (type == SOCK_STREAM) {
|
||||
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
|
||||
return UV_TCP;
|
||||
if (sa.sa_family == AF_UNIX)
|
||||
return UV_NAMED_PIPE;
|
||||
}
|
||||
|
||||
return UV_NAMED_PIPE;
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
}
|
||||
|
||||
|
||||
|
30
deps/uv/test/runner-win.c
vendored
30
deps/uv/test/runner-win.c
vendored
@ -44,6 +44,11 @@
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
void platform_init(int argc, char **argv) {
|
||||
const char* tap;
|
||||
|
||||
tap = getenv("UV_TAP_OUTPUT");
|
||||
tap_output = (tap != NULL && atoi(tap) > 0);
|
||||
|
||||
/* Disable the "application crashed" popup. */
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
|
||||
SEM_NOOPENFILEERRORBOX);
|
||||
@ -207,13 +212,34 @@ long int process_output_size(process_info_t *p) {
|
||||
int process_copy_output(process_info_t *p, int fd) {
|
||||
DWORD read;
|
||||
char buf[1024];
|
||||
char *line, *start;
|
||||
|
||||
if (SetFilePointer(p->stdio_out, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
|
||||
return -1;
|
||||
|
||||
if (tap_output)
|
||||
write(fd, "#", 1);
|
||||
|
||||
while (ReadFile(p->stdio_out, (void*)&buf, sizeof(buf), &read, NULL) &&
|
||||
read > 0)
|
||||
write(fd, buf, read);
|
||||
read > 0) {
|
||||
if (tap_output) {
|
||||
start = buf;
|
||||
|
||||
while ((line = strchr(start, '\n')) != NULL) {
|
||||
write(fd, start, line - start + 1);
|
||||
write(fd, "#", 1);
|
||||
start = line + 1;
|
||||
}
|
||||
|
||||
if (start < buf + read)
|
||||
write(fd, start, buf + read - start);
|
||||
} else {
|
||||
write(fd, buf, read);
|
||||
}
|
||||
}
|
||||
|
||||
if (tap_output)
|
||||
write(fd, "\n", 1);
|
||||
|
||||
if (GetLastError() != ERROR_HANDLE_EOF)
|
||||
return -1;
|
||||
|
@ -934,6 +934,7 @@ var createServerHandle = exports._createServerHandle =
|
||||
var type = tty_wrap.guessHandleType(fd);
|
||||
switch (type) {
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
debug('listen pipe fd=' + fd);
|
||||
// create a PipeWrap
|
||||
handle = createPipe();
|
||||
|
@ -569,6 +569,7 @@
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = NativeModule.require('net');
|
||||
stream = new net.Socket({
|
||||
fd: fd,
|
||||
@ -654,6 +655,7 @@
|
||||
break;
|
||||
|
||||
case 'PIPE':
|
||||
case 'TCP':
|
||||
var net = NativeModule.require('net');
|
||||
stdin = new net.Socket({
|
||||
fd: fd,
|
||||
|
@ -105,9 +105,15 @@ Handle<Value> TTYWrap::GuessHandleType(const Arguments& args) {
|
||||
uv_handle_type t = uv_guess_handle(fd);
|
||||
|
||||
switch (t) {
|
||||
case UV_TCP:
|
||||
return scope.Close(String::New("TCP"));
|
||||
|
||||
case UV_TTY:
|
||||
return scope.Close(String::New("TTY"));
|
||||
|
||||
case UV_UDP:
|
||||
return scope.Close(String::New("UDP"));
|
||||
|
||||
case UV_NAMED_PIPE:
|
||||
return scope.Close(String::New("PIPE"));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user