summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Zinkovsky <igorzi@microsoft.com>2011-12-01 13:56:04 -0800
committerIgor Zinkovsky <igorzi@microsoft.com>2011-12-01 13:56:04 -0800
commitdd4b280d8cb50bf818f2fae9f8e47f9f219e8328 (patch)
tree539d7cf5b5e17f555c53c0fbed49664070cac799
parentae648a44c48e0de0149f83880be542609588c80f (diff)
downloadnode-dd4b280d8cb50bf818f2fae9f8e47f9f219e8328.tar.gz
upgrade libuv to 60630dab0f
-rw-r--r--deps/uv/include/uv-private/uv-win.h3
-rw-r--r--deps/uv/include/uv.h7
-rw-r--r--deps/uv/src/unix/pipe.c5
-rw-r--r--deps/uv/src/win/pipe.c31
4 files changed, 41 insertions, 5 deletions
diff --git a/deps/uv/include/uv-private/uv-win.h b/deps/uv/include/uv-private/uv-win.h
index 5d461090f..7c1818cbc 100644
--- a/deps/uv/include/uv-private/uv-win.h
+++ b/deps/uv/include/uv-private/uv-win.h
@@ -276,7 +276,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
LPFN_WSARECVFROM func_wsarecvfrom;
#define uv_pipe_server_fields \
- uv_pipe_accept_t accept_reqs[4]; \
+ int pending_instances; \
+ uv_pipe_accept_t* accept_reqs; \
uv_pipe_accept_t* pending_accepts;
#define uv_pipe_connection_fields \
diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h
index ea845e3a4..e8b70b180 100644
--- a/deps/uv/include/uv.h
+++ b/deps/uv/include/uv.h
@@ -772,6 +772,13 @@ UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name);
UV_EXTERN void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
const char* name, uv_connect_cb cb);
+/*
+ * This setting applies to Windows only.
+ * Set the number of pending pipe instance handles when the pipe server
+ * is waiting for connections.
+ */
+UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
+
/*
* uv_prepare_t is a subclass of uv_handle_t.
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 87959a6e5..43869b638 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -271,3 +271,8 @@ void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) {
errno = saved_errno;
}
+
+
+void uv_pipe_pending_instances(uv_pipe_t* handle, int count) {
+ return 0;
+}
diff --git a/deps/uv/src/win/pipe.c b/deps/uv/src/win/pipe.c
index 5dada4f9c..3bbfa8338 100644
--- a/deps/uv/src/win/pipe.c
+++ b/deps/uv/src/win/pipe.c
@@ -39,6 +39,8 @@ static const uv_buf_t uv_null_buf_ = { 0, NULL };
/* when the local ends wants to shut it down. */
static const int64_t eof_timeout = 50; /* ms */
+static const int default_pending_pipe_instances = 4;
+
/* IPC protocol flags. */
#define UV_IPC_RAW_DATA 0x0001
#define UV_IPC_UV_STREAM 0x0002
@@ -293,6 +295,12 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) {
}
}
+ if (handle->flags & UV_HANDLE_PIPESERVER) {
+ assert(handle->accept_reqs);
+ free(handle->accept_reqs);
+ handle->accept_reqs = NULL;
+ }
+
/* Remember the state of this flag because the close callback is */
/* allowed to clobber or free the handle's memory */
uv_alloced = handle->flags & UV_HANDLE_UV_ALLOCED;
@@ -310,6 +318,12 @@ void uv_pipe_endgame(uv_loop_t* loop, uv_pipe_t* handle) {
}
+void uv_pipe_pending_instances(uv_pipe_t* handle, int count) {
+ handle->pending_instances = count;
+ handle->flags |= UV_HANDLE_PIPESERVER;
+}
+
+
/* Creates a pipe server. */
int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
uv_loop_t* loop = handle->loop;
@@ -326,7 +340,17 @@ int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
return -1;
}
- for (i = 0; i < COUNTOF(handle->accept_reqs); i++) {
+ if (!(handle->flags & UV_HANDLE_PIPESERVER)) {
+ handle->pending_instances = default_pending_pipe_instances;
+ }
+
+ handle->accept_reqs = (uv_pipe_accept_t*)
+ malloc(sizeof(uv_pipe_accept_t) * handle->pending_instances);
+ if (!handle->accept_reqs) {
+ uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
+ }
+
+ for (i = 0; i < handle->pending_instances; i++) {
req = &handle->accept_reqs[i];
uv_req_init(loop, (uv_req_t*) req);
req->type = UV_ACCEPT;
@@ -537,14 +561,13 @@ void close_pipe(uv_pipe_t* handle, int* status, uv_err_t* err) {
}
if (handle->flags & UV_HANDLE_PIPESERVER) {
- for (i = 0; i < COUNTOF(handle->accept_reqs); i++) {
+ for (i = 0; i < handle->pending_instances; i++) {
pipeHandle = handle->accept_reqs[i].pipeHandle;
if (pipeHandle != INVALID_HANDLE_VALUE) {
CloseHandle(pipeHandle);
handle->accept_reqs[i].pipeHandle = INVALID_HANDLE_VALUE;
}
}
-
}
if (handle->flags & UV_HANDLE_CONNECTION) {
@@ -686,7 +709,7 @@ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) {
/* First pipe handle should have already been created in uv_pipe_bind */
assert(handle->accept_reqs[0].pipeHandle != INVALID_HANDLE_VALUE);
- for (i = 0; i < COUNTOF(handle->accept_reqs); i++) {
+ for (i = 0; i < handle->pending_instances; i++) {
uv_pipe_queue_accept(loop, handle, &handle->accept_reqs[i], i == 0);
}