diff --git a/include/uv.h b/include/uv.h index 9d661e51..c2efa0a9 100644 --- a/include/uv.h +++ b/include/uv.h @@ -763,7 +763,7 @@ UV_EXTERN void uv_pipe_open(uv_pipe_t*, uv_file file); UV_EXTERN int uv_pipe_bind(uv_pipe_t* handle, const char* name); -UV_EXTERN int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, +UV_EXTERN void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb); diff --git a/src/unix/pipe.c b/src/unix/pipe.c index 47de1b3b..87959a6e 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -177,7 +177,7 @@ void uv_pipe_open(uv_pipe_t* handle, uv_file fd) { } -int uv_pipe_connect(uv_connect_t* req, +void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) { @@ -237,7 +237,6 @@ out: * return 0 and let the callback handle errors. */ errno = saved_errno; - return 0; } diff --git a/src/win/pipe.c b/src/win/pipe.c index 6fb8159e..bd187da5 100644 --- a/src/win/pipe.c +++ b/src/win/pipe.c @@ -443,7 +443,7 @@ static DWORD WINAPI pipe_connect_thread_proc(void* parameter) { } -int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, +void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, const char* name, uv_connect_cb cb) { uv_loop_t* loop = handle->loop; int errno, nameSize; @@ -488,7 +488,7 @@ int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, handle->reqs_pending++; - return 0; + return; } errno = GetLastError(); @@ -505,7 +505,7 @@ int uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle, SET_REQ_SUCCESS(req); uv_insert_pending_req(loop, (uv_req_t*) req); handle->reqs_pending++; - return 0; + return; error: if (handle->name) { @@ -516,8 +516,12 @@ error: if (pipeHandle != INVALID_HANDLE_VALUE) { CloseHandle(pipeHandle); } - uv__set_sys_error(loop, errno); - return -1; + + /* Make this req pending reporting an error. */ + SET_REQ_ERROR(req, errno); + uv_insert_pending_req(loop, (uv_req_t*) req); + handle->reqs_pending++; + return; } diff --git a/test/benchmark-pound.c b/test/benchmark-pound.c index af7ce247..92a536db 100644 --- a/test/benchmark-pound.c +++ b/test/benchmark-pound.c @@ -225,12 +225,7 @@ static void pipe_make_connect(conn_rec* p) { r = uv_pipe_init(loop, (uv_pipe_t*)&p->stream, 0); ASSERT(r == 0); - r = uv_pipe_connect(&((pipe_conn_rec*)p)->conn_req, (uv_pipe_t*)&p->stream, TEST_PIPENAME, connect_cb); - if (r) { - fprintf(stderr, "uv_tcp_connect error %s\n", - uv_err_name(uv_last_error(loop))); - ASSERT(0); - } + uv_pipe_connect(&((pipe_conn_rec*)p)->conn_req, (uv_pipe_t*)&p->stream, TEST_PIPENAME, connect_cb); #if DEBUG printf("make connect %d\n", p->i); diff --git a/test/benchmark-pump.c b/test/benchmark-pump.c index 27e8abe0..52f29572 100644 --- a/test/benchmark-pump.c +++ b/test/benchmark-pump.c @@ -257,8 +257,7 @@ static void maybe_connect_some() { ASSERT(r == 0); req = (uv_connect_t*) req_alloc(); - r = uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); - ASSERT(r == 0); + uv_pipe_connect(req, pipe, TEST_PIPENAME, connect_cb); } } } diff --git a/test/test-ping-pong.c b/test/test-ping-pong.c index 0e59166c..b73b4ce4 100644 --- a/test/test-ping-pong.c +++ b/test/test-ping-pong.c @@ -211,9 +211,8 @@ static void pipe_pinger_new() { /* We are never doing multiple reads/connects at a time anyway. */ /* so these handles can be pre-initialized. */ - r = uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME, + uv_pipe_connect(&pinger->connect_req, &pinger->stream.pipe, TEST_PIPENAME, pinger_on_connect); - ASSERT(!r); /* Synchronous connect callbacks are not allowed. */ ASSERT(pinger_on_connect_count == 0); diff --git a/test/test-pipe-connect-error.c b/test/test-pipe-connect-error.c index 6106cc42..2faa4461 100644 --- a/test/test-pipe-connect-error.c +++ b/test/test-pipe-connect-error.c @@ -58,7 +58,6 @@ TEST_IMPL(pipe_connect_bad_name) { r = uv_pipe_init(uv_default_loop(), &client, 0); ASSERT(r == 0); uv_pipe_connect(&req, &client, BAD_PIPENAME, connect_cb); - ASSERT(r == 0); uv_run(uv_default_loop());