Skip to content

Commit e99dff4

Browse files
committed
deps: upgrade libuv to 7b66ea1
1 parent 028c630 commit e99dff4

File tree

7 files changed

+79
-17
lines changed

7 files changed

+79
-17
lines changed

deps/uv/include/uv.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extern "C" {
4747

4848

4949
#define UV_VERSION_MAJOR 0
50-
#define UV_VERSION_MINOR 9
50+
#define UV_VERSION_MINOR 10
5151

5252

5353
#if defined(_MSC_VER) && _MSC_VER < 1600
@@ -660,12 +660,12 @@ UV_EXTERN int uv_tcp_keepalive(uv_tcp_t* handle,
660660
unsigned int delay);
661661

662662
/*
663-
* This setting applies to Windows only.
664663
* Enable/disable simultaneous asynchronous accept requests that are
665664
* queued by the operating system when listening for new tcp connections.
666665
* This setting is used to tune a tcp server for the desired performance.
667666
* Having simultaneous accepts can significantly improve the rate of
668-
* accepting connections (which is why it is enabled by default).
667+
* accepting connections (which is why it is enabled by default) but
668+
* may lead to uneven load distribution in multi-process setups.
669669
*/
670670
UV_EXTERN int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable);
671671

deps/uv/src/unix/tcp.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ int uv_tcp_keepalive(uv_tcp_t* handle, int on, unsigned int delay) {
343343
}
344344

345345

346-
int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int on) {
347-
if (on)
348-
handle->flags |= UV_TCP_SINGLE_ACCEPT;
349-
else
346+
int uv_tcp_simultaneous_accepts(uv_tcp_t* handle, int enable) {
347+
if (enable)
350348
handle->flags &= ~UV_TCP_SINGLE_ACCEPT;
349+
else
350+
handle->flags |= UV_TCP_SINGLE_ACCEPT;
351351
return 0;
352352
}
353353

deps/uv/src/unix/tty.c

+35-8
Original file line numberDiff line numberDiff line change
@@ -118,25 +118,52 @@ int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) {
118118

119119

120120
uv_handle_type uv_guess_handle(uv_file file) {
121+
struct sockaddr sa;
121122
struct stat s;
123+
socklen_t len;
124+
int type;
122125

123-
if (file < 0) {
126+
if (file < 0)
124127
return UV_UNKNOWN_HANDLE;
125-
}
126128

127-
if (isatty(file)) {
129+
if (isatty(file))
128130
return UV_TTY;
129-
}
130131

131-
if (fstat(file, &s)) {
132+
if (fstat(file, &s))
132133
return UV_UNKNOWN_HANDLE;
133-
}
134134

135-
if (!S_ISSOCK(s.st_mode) && !S_ISFIFO(s.st_mode)) {
135+
if (S_ISREG(s.st_mode))
136136
return UV_FILE;
137+
138+
if (S_ISCHR(s.st_mode))
139+
return UV_FILE; /* XXX UV_NAMED_PIPE? */
140+
141+
if (S_ISFIFO(s.st_mode))
142+
return UV_NAMED_PIPE;
143+
144+
if (!S_ISSOCK(s.st_mode))
145+
return UV_UNKNOWN_HANDLE;
146+
147+
len = sizeof(type);
148+
if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len))
149+
return UV_UNKNOWN_HANDLE;
150+
151+
len = sizeof(sa);
152+
if (getsockname(file, &sa, &len))
153+
return UV_UNKNOWN_HANDLE;
154+
155+
if (type == SOCK_DGRAM)
156+
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
157+
return UV_UDP;
158+
159+
if (type == SOCK_STREAM) {
160+
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
161+
return UV_TCP;
162+
if (sa.sa_family == AF_UNIX)
163+
return UV_NAMED_PIPE;
137164
}
138165

139-
return UV_NAMED_PIPE;
166+
return UV_UNKNOWN_HANDLE;
140167
}
141168

142169

deps/uv/test/runner-win.c

+28-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@
4444

4545
/* Do platform-specific initialization. */
4646
void platform_init(int argc, char **argv) {
47+
const char* tap;
48+
49+
tap = getenv("UV_TAP_OUTPUT");
50+
tap_output = (tap != NULL && atoi(tap) > 0);
51+
4752
/* Disable the "application crashed" popup. */
4853
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
4954
SEM_NOOPENFILEERRORBOX);
@@ -207,13 +212,34 @@ long int process_output_size(process_info_t *p) {
207212
int process_copy_output(process_info_t *p, int fd) {
208213
DWORD read;
209214
char buf[1024];
215+
char *line, *start;
210216

211217
if (SetFilePointer(p->stdio_out, 0, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER)
212218
return -1;
213219

220+
if (tap_output)
221+
write(fd, "#", 1);
222+
214223
while (ReadFile(p->stdio_out, (void*)&buf, sizeof(buf), &read, NULL) &&
215-
read > 0)
216-
write(fd, buf, read);
224+
read > 0) {
225+
if (tap_output) {
226+
start = buf;
227+
228+
while ((line = strchr(start, '\n')) != NULL) {
229+
write(fd, start, line - start + 1);
230+
write(fd, "#", 1);
231+
start = line + 1;
232+
}
233+
234+
if (start < buf + read)
235+
write(fd, start, buf + read - start);
236+
} else {
237+
write(fd, buf, read);
238+
}
239+
}
240+
241+
if (tap_output)
242+
write(fd, "\n", 1);
217243

218244
if (GetLastError() != ERROR_HANDLE_EOF)
219245
return -1;

lib/net.js

+1
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ var createServerHandle = exports._createServerHandle =
934934
var type = tty_wrap.guessHandleType(fd);
935935
switch (type) {
936936
case 'PIPE':
937+
case 'TCP':
937938
debug('listen pipe fd=' + fd);
938939
// create a PipeWrap
939940
handle = createPipe();

src/node.js

+2
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@
569569
break;
570570

571571
case 'PIPE':
572+
case 'TCP':
572573
var net = NativeModule.require('net');
573574
stream = new net.Socket({
574575
fd: fd,
@@ -654,6 +655,7 @@
654655
break;
655656

656657
case 'PIPE':
658+
case 'TCP':
657659
var net = NativeModule.require('net');
658660
stdin = new net.Socket({
659661
fd: fd,

src/tty_wrap.cc

+6
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,15 @@ Handle<Value> TTYWrap::GuessHandleType(const Arguments& args) {
105105
uv_handle_type t = uv_guess_handle(fd);
106106

107107
switch (t) {
108+
case UV_TCP:
109+
return scope.Close(String::New("TCP"));
110+
108111
case UV_TTY:
109112
return scope.Close(String::New("TTY"));
110113

114+
case UV_UDP:
115+
return scope.Close(String::New("UDP"));
116+
111117
case UV_NAMED_PIPE:
112118
return scope.Close(String::New("PIPE"));
113119

0 commit comments

Comments
 (0)