summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_conn_close.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_conn_close.c')
-rw-r--r--src/nxt_conn_close.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nxt_conn_close.c b/src/nxt_conn_close.c
index 7c130309..92bd8d1b 100644
--- a/src/nxt_conn_close.c
+++ b/src/nxt_conn_close.c
@@ -119,6 +119,8 @@ nxt_conn_close_handler(nxt_task_t *task, void *obj, void *data)
nxt_socket_close(task, c->socket.fd);
c->socket.fd = -1;
+ engine->closed_conns_cnt++;
+
if (timers_pending == 0) {
nxt_work_queue_add(&engine->fast_work_queue,
c->write_state->ready_handler,
@@ -137,8 +139,9 @@ nxt_conn_close_handler(nxt_task_t *task, void *obj, void *data)
static void
nxt_conn_close_timer_handler(nxt_task_t *task, void *obj, void *data)
{
- nxt_conn_t *c;
- nxt_timer_t *timer;
+ nxt_conn_t *c;
+ nxt_timer_t *timer;
+ nxt_event_engine_t *engine;
timer = obj;
@@ -146,13 +149,16 @@ nxt_conn_close_timer_handler(nxt_task_t *task, void *obj, void *data)
nxt_debug(task, "conn close timer handler fd:%d", c->socket.fd);
+ engine = task->thread->engine;
+
if (c->socket.fd != -1) {
nxt_socket_close(task, c->socket.fd);
c->socket.fd = -1;
+
+ engine->closed_conns_cnt++;
}
- nxt_work_queue_add(&task->thread->engine->fast_work_queue,
- c->write_state->ready_handler,
+ nxt_work_queue_add(&engine->fast_work_queue, c->write_state->ready_handler,
task, c, c->socket.data);
}