Skip to content

Commit

Permalink
unix: remove uv__pipe_accept()
Browse files Browse the repository at this point in the history
It's basically a less advanced version of uv__server_io().  Drop the
former in favor of the latter.
  • Loading branch information
bnoordhuis committed Oct 1, 2013
1 parent 359d667 commit 0d435a5
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions src/unix/pipe.c
Expand Up @@ -29,8 +29,6 @@
#include <unistd.h>
#include <stdlib.h>

static void uv__pipe_accept(uv_loop_t* loop, uv__io_t* w, unsigned int events);


int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE);
Expand Down Expand Up @@ -111,7 +109,7 @@ int uv_pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) {
return -errno;

handle->connection_cb = cb;
handle->io_watcher.cb = uv__pipe_accept;
handle->io_watcher.cb = uv__server_io;
uv__io_start(handle->loop, &handle->io_watcher, UV__POLLIN);
return 0;
}
Expand Down Expand Up @@ -212,29 +210,5 @@ void uv_pipe_connect(uv_connect_t* req,
}


/* TODO merge with uv__server_io()? */
static void uv__pipe_accept(uv_loop_t* loop, uv__io_t* w, unsigned int events) {
uv_pipe_t* pipe;
int sockfd;

pipe = container_of(w, uv_pipe_t, io_watcher);
assert(pipe->type == UV_NAMED_PIPE);

sockfd = uv__accept(uv__stream_fd(pipe));
if (sockfd == -1) {
if (errno != EAGAIN && errno != EWOULDBLOCK)
pipe->connection_cb((uv_stream_t*)pipe, -errno);
return;
}

pipe->accepted_fd = sockfd;
pipe->connection_cb((uv_stream_t*)pipe, 0);
if (pipe->accepted_fd == sockfd) {
/* The user hasn't called uv_accept() yet */
uv__io_stop(pipe->loop, &pipe->io_watcher, UV__POLLIN);
}
}


void uv_pipe_pending_instances(uv_pipe_t* handle, int count) {
}

0 comments on commit 0d435a5

Please sign in to comment.