summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_epoll_engine.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_epoll_engine.c')
-rw-r--r--src/nxt_epoll_engine.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/nxt_epoll_engine.c b/src/nxt_epoll_engine.c
index 4e2dd5c0..7e9a0b1c 100644
--- a/src/nxt_epoll_engine.c
+++ b/src/nxt_epoll_engine.c
@@ -985,7 +985,7 @@ nxt_epoll_poll(nxt_event_engine_t *engine, nxt_msec_t timeout)
static void
nxt_epoll_conn_io_accept4(nxt_task_t *task, void *obj, void *data)
{
- socklen_t len;
+ socklen_t socklen;
nxt_conn_t *c;
nxt_socket_t s;
struct sockaddr *sa;
@@ -997,17 +997,13 @@ nxt_epoll_conn_io_accept4(nxt_task_t *task, void *obj, void *data)
lev->ready--;
lev->socket.read_ready = (lev->ready != 0);
- len = c->remote->socklen;
-
- if (len >= sizeof(struct sockaddr)) {
- sa = &c->remote->u.sockaddr;
-
- } else {
- sa = NULL;
- len = 0;
- }
-
- s = accept4(lev->socket.fd, sa, &len, SOCK_NONBLOCK);
+ sa = &c->remote->u.sockaddr;
+ socklen = c->remote->socklen;
+ /*
+ * The returned socklen is ignored here,
+ * see comment in nxt_conn_io_accept().
+ */
+ s = accept4(lev->socket.fd, sa, &socklen, SOCK_NONBLOCK);
if (s != -1) {
c->socket.fd = s;