unix: remove uv__pipe_accept()
It's basically a less advanced version of uv__server_io(). Drop the former in favor of the latter.
This commit is contained in:
parent
359d667893
commit
0d435a5662
@ -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);
|
||||
@ -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;
|
||||
}
|
||||
@ -212,29 +210,5 @@ out:
|
||||
}
|
||||
|
||||
|
||||
/* 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) {
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user