Lines Matching refs:lev

22     nxt_listen_event_t *lev);
26 nxt_listen_event_t *lev);
28 nxt_listen_event_t *lev);
40 nxt_listen_event_t *lev; in nxt_listen_event() local
43 lev = nxt_zalloc(sizeof(nxt_listen_event_t)); in nxt_listen_event()
45 if (nxt_fast_path(lev != NULL)) { in nxt_listen_event()
46 lev->socket.fd = ls->socket; in nxt_listen_event()
49 lev->batch = engine->batch; in nxt_listen_event()
50 lev->count = 1; in nxt_listen_event()
52 lev->socket.read_work_queue = &engine->accept_work_queue; in nxt_listen_event()
53 lev->socket.read_handler = nxt_conn_listen_handler; in nxt_listen_event()
54 lev->socket.error_handler = nxt_conn_listen_event_error; in nxt_listen_event()
55 lev->socket.log = &nxt_main_log; in nxt_listen_event()
57 lev->accept = engine->event.io->accept; in nxt_listen_event()
59 lev->listen = ls; in nxt_listen_event()
60 lev->work_queue = &engine->read_work_queue; in nxt_listen_event()
62 lev->timer.work_queue = &engine->fast_work_queue; in nxt_listen_event()
63 lev->timer.handler = nxt_conn_listen_timer_handler; in nxt_listen_event()
64 lev->timer.log = &nxt_main_log; in nxt_listen_event()
66 lev->task.thread = task->thread; in nxt_listen_event()
67 lev->task.log = &nxt_main_log; in nxt_listen_event()
68 lev->task.ident = nxt_task_next_ident(); in nxt_listen_event()
69 lev->socket.task = &lev->task; in nxt_listen_event()
70 lev->timer.task = &lev->task; in nxt_listen_event()
72 if (nxt_conn_accept_alloc(task, lev) != NULL) { in nxt_listen_event()
73 nxt_fd_event_enable_accept(engine, &lev->socket); in nxt_listen_event()
75 nxt_queue_insert_tail(&engine->listen_connections, &lev->link); in nxt_listen_event()
78 return lev; in nxt_listen_event()
86 nxt_conn_accept_alloc(nxt_task_t *task, nxt_listen_event_t *lev) in nxt_conn_accept_alloc() argument
99 c = nxt_conn_create(mp, lev->socket.task); in nxt_conn_accept_alloc()
106 c->socket.read_work_queue = lev->socket.read_work_queue; in nxt_conn_accept_alloc()
109 c->remote = nxt_sockaddr_cache_alloc(engine, lev->listen); in nxt_conn_accept_alloc()
111 lev->next = c; in nxt_conn_accept_alloc()
126 nxt_listen_event_t *lev; in nxt_conn_listen_handler() local
128 lev = obj; in nxt_conn_listen_handler()
129 lev->ready = lev->batch; in nxt_conn_listen_handler()
131 lev->accept(task, lev, data); in nxt_conn_listen_handler()
142 nxt_listen_event_t *lev; in nxt_conn_io_accept() local
144 lev = obj; in nxt_conn_io_accept()
145 c = lev->next; in nxt_conn_io_accept()
147 lev->ready--; in nxt_conn_io_accept()
148 lev->socket.read_ready = (lev->ready != 0); in nxt_conn_io_accept()
161 s = accept(lev->socket.fd, sa, &socklen); in nxt_conn_io_accept()
164 nxt_conn_accept_error(task, lev, "accept", nxt_socket_errno); in nxt_conn_io_accept()
181 nxt_debug(task, "accept(%d): %d", lev->socket.fd, s); in nxt_conn_io_accept()
183 nxt_conn_accept(task, lev, c); in nxt_conn_io_accept()
188 nxt_conn_accept(nxt_task_t *task, nxt_listen_event_t *lev, nxt_conn_t *c) in nxt_conn_accept() argument
200 c->listen = lev; in nxt_conn_accept()
201 lev->count++; in nxt_conn_accept()
202 lev->next = NULL; in nxt_conn_accept()
205 c->read_work_queue = lev->work_queue; in nxt_conn_accept()
206 c->write_work_queue = lev->work_queue; in nxt_conn_accept()
208 if (lev->listen->read_after_accept) { in nxt_conn_accept()
212 nxt_work_queue_add(c->read_work_queue, lev->listen->handler, in nxt_conn_accept()
213 &c->task, c, lev); in nxt_conn_accept()
216 nxt_work_queue_add(c->write_work_queue, lev->listen->handler, in nxt_conn_accept()
217 &c->task, c, lev); in nxt_conn_accept()
220 next = nxt_conn_accept_next(task, lev); in nxt_conn_accept()
222 if (next != NULL && lev->socket.read_ready) { in nxt_conn_accept()
223 nxt_work_queue_add(lev->socket.read_work_queue, in nxt_conn_accept()
224 lev->accept, task, lev, next); in nxt_conn_accept()
230 nxt_conn_accept_next(nxt_task_t *task, nxt_listen_event_t *lev) in nxt_conn_accept_next() argument
234 c = lev->next; in nxt_conn_accept_next()
237 c = nxt_conn_accept_alloc(task, lev); in nxt_conn_accept_next()
240 nxt_conn_accept_close_idle(task, lev); in nxt_conn_accept_next()
249 nxt_conn_accept_close_idle(nxt_task_t *task, nxt_listen_event_t *lev) in nxt_conn_accept_close_idle() argument
258 nxt_timer_add(engine, &lev->timer, 100); in nxt_conn_accept_close_idle()
260 nxt_fd_event_disable_read(engine, &lev->socket); in nxt_conn_accept_close_idle()
312 nxt_conn_accept_error(nxt_task_t *task, nxt_listen_event_t *lev, in nxt_conn_accept_error() argument
319 lev->socket.read_ready = 0; in nxt_conn_accept_error()
324 nxt_debug(task, "%s(%d) %E", accept_syscall, lev->socket.fd, err); in nxt_conn_accept_error()
330 accept_syscall, lev->socket.fd, err); in nxt_conn_accept_error()
338 accept_syscall, lev->socket.fd, err); in nxt_conn_accept_error()
340 nxt_conn_accept_close_idle(task, lev); in nxt_conn_accept_error()
345 accept_syscall, lev->socket.fd, err); in nxt_conn_accept_error()
356 nxt_listen_event_t *lev; in nxt_conn_listen_timer_handler() local
360 lev = nxt_timer_data(timer, nxt_listen_event_t, timer); in nxt_conn_listen_timer_handler()
362 c = nxt_conn_accept_next(task, lev); in nxt_conn_listen_timer_handler()
367 nxt_fd_event_enable_accept(task->thread->engine, &lev->socket); in nxt_conn_listen_timer_handler()
369 lev->accept(task, lev, c); in nxt_conn_listen_timer_handler()