aboutsummaryrefslogtreecommitdiff
path: root/deps/uv/src/unix/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/uv/src/unix/pipe.c')
-rw-r--r--deps/uv/src/unix/pipe.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/deps/uv/src/unix/pipe.c b/deps/uv/src/unix/pipe.c
index 3573a57105..7d0b2ec70b 100644
--- a/deps/uv/src/unix/pipe.c
+++ b/deps/uv/src/unix/pipe.c
@@ -146,29 +146,19 @@ out:
}
-int uv_pipe_cleanup(uv_pipe_t* handle) {
- int saved_errno;
- int status;
-
- saved_errno = errno;
- status = -1;
-
+void uv__pipe_close(uv_pipe_t* handle) {
if (handle->pipe_fname) {
/*
* Unlink the file system entity before closing the file descriptor.
* Doing it the other way around introduces a race where our process
* unlinks a socket with the same name that's just been created by
* another thread or process.
- *
- * This is less of an issue now that we attach a file lock
- * to the socket but it's still a best practice.
*/
unlink(handle->pipe_fname);
free((void*)handle->pipe_fname);
}
- errno = saved_errno;
- return status;
+ uv__stream_close((uv_stream_t*)handle);
}
@@ -254,16 +244,15 @@ void uv__pipe_accept(EV_P_ ev_io* watcher, int revents) {
sockfd = uv__accept(pipe->fd, (struct sockaddr *)&saddr, sizeof saddr);
if (sockfd == -1) {
- if (errno == EAGAIN || errno == EWOULDBLOCK) {
- assert(0 && "EAGAIN on uv__accept(pipefd)");
- } else {
+ if (errno != EAGAIN && errno != EWOULDBLOCK) {
uv__set_sys_error(pipe->loop, errno);
+ pipe->connection_cb((uv_stream_t*)pipe, -1);
}
} else {
pipe->accepted_fd = sockfd;
pipe->connection_cb((uv_stream_t*)pipe, 0);
if (pipe->accepted_fd == sockfd) {
- /* The user hasn't yet accepted called uv_accept() */
+ /* The user hasn't called uv_accept() yet */
ev_io_stop(pipe->loop->ev, &pipe->read_watcher);
}
}