From c4549b857364e736cdac8cad15aa7b49283daa90 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 11 Aug 2011 00:36:22 +0200 Subject: [PATCH] uv: upgrade to b6b97f3 --- deps/uv/src/uv-unix.c | 16 ++++++++-------- deps/uv/src/win/process.c | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/deps/uv/src/uv-unix.c b/deps/uv/src/uv-unix.c index 48357016bfc..15e9dec6eed 100644 --- a/deps/uv/src/uv-unix.c +++ b/deps/uv/src/uv-unix.c @@ -427,14 +427,17 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) { watcher == &stream->write_watcher); assert(revents == EV_READ); - assert(!(((uv_handle_t*)stream)->flags & UV_CLOSING)); + assert(!(stream->flags & UV_CLOSING)); if (stream->accepted_fd >= 0) { ev_io_stop(EV_DEFAULT_ &stream->read_watcher); return; } - while (1) { + /* connection_cb can close the server socket while we're + * in the loop so check it on each iteration. + */ + while (stream->fd != -1) { assert(stream->accepted_fd < 0); fd = uv__accept(stream->fd, (struct sockaddr*)&addr, sizeof addr); @@ -449,7 +452,6 @@ void uv__server_io(EV_P_ ev_io* watcher, int revents) { uv_err_new((uv_handle_t*)stream, errno); stream->connection_cb((uv_stream_t*)stream, -1); } - } else { stream->accepted_fd = fd; stream->connection_cb((uv_stream_t*)stream, 0); @@ -897,7 +899,7 @@ static void uv__stream_io(EV_P_ ev_io* watcher, int revents) { stream->type == UV_NAMED_PIPE); assert(watcher == &stream->read_watcher || watcher == &stream->write_watcher); - assert(!(((uv_handle_t*)stream)->flags & UV_CLOSING)); + assert(!(stream->flags & UV_CLOSING)); if (stream->connect_req) { uv__stream_connect(stream); @@ -985,10 +987,6 @@ static int uv__connect(uv_connect_t* req, if (stream->fd <= 0) { if ((sockfd = uv__socket(addr->sa_family, SOCK_STREAM, 0)) == -1) { - - } - - if (sockfd < 0) { uv_err_new((uv_handle_t*)stream, errno); return -1; } @@ -2065,6 +2063,8 @@ static int uv__socket(int domain, int type, int protocol) { static int uv__accept(int sockfd, struct sockaddr* saddr, socklen_t slen) { int peerfd; + assert(sockfd >= 0); + do { #if defined(SOCK_NONBLOCK) && defined(SOCK_CLOEXEC) peerfd = accept4(sockfd, saddr, &slen, SOCK_NONBLOCK | SOCK_CLOEXEC); diff --git a/deps/uv/src/win/process.c b/deps/uv/src/win/process.c index eac889aedc8..664b329452c 100644 --- a/deps/uv/src/win/process.c +++ b/deps/uv/src/win/process.c @@ -36,7 +36,7 @@ typedef struct env_var { int value_len; } env_var_t; -#define E_V(str) { ##str"=", L##str, sizeof(##str), 0, 0 } +#define E_V(str) { str "=", L"" str, sizeof(str), 0, 0 } #define UTF8_TO_UTF16(s, t) \ size = uv_utf8_to_utf16(s, NULL, 0) * sizeof(wchar_t); \