diff --git a/src/unix/pipe.c b/src/unix/pipe.c index b28c8ef9..1185b91a 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -183,9 +183,6 @@ void uv_pipe_connect(uv_connect_t* req, uv_strlcpy(saddr.sun_path, name, sizeof(saddr.sun_path)); saddr.sun_family = AF_UNIX; - /* We don't check for EINPROGRESS. Think about it: the socket - * is either there or not. - */ do { r = connect(uv__stream_fd(handle), (struct sockaddr*)&saddr, sizeof saddr); @@ -193,7 +190,8 @@ void uv_pipe_connect(uv_connect_t* req, while (r == -1 && errno == EINTR); if (r == -1) - goto out; + if (errno != EINPROGRESS) + goto out; if (new_sock) if (uv__stream_open((uv_stream_t*)handle, @@ -213,8 +211,9 @@ out: req->cb = cb; ngx_queue_init(&req->queue); - /* Run callback on next tick. */ - uv__io_feed(handle->loop, &handle->io_watcher); + /* Force callback to run on next tick in case of error. */ + if (err != 0) + uv__io_feed(handle->loop, &handle->io_watcher); /* Mimic the Windows pipe implementation, always * return 0 and let the callback handle errors.