diff options
author | Konstantin Pavlov <thresh@nginx.com> | 2022-09-13 13:17:16 +0400 |
---|---|---|
committer | Konstantin Pavlov <thresh@nginx.com> | 2022-09-13 13:17:16 +0400 |
commit | ce964aa30b163e2b3263c5af57c1a6dae7d0cebb (patch) | |
tree | 26bf70c1a5991f6471fc4caed8628e068fdc0b7b /src/nxt_conn_close.c | |
parent | eba4c3c98fa1bf275d94df8c727f70692ae7eae1 (diff) | |
parent | 38bd7e76a134084ab95a4ee3125af1ccd7b35864 (diff) | |
download | unit-ce964aa30b163e2b3263c5af57c1a6dae7d0cebb.tar.gz unit-ce964aa30b163e2b3263c5af57c1a6dae7d0cebb.tar.bz2 |
Merged with the default branch.1.28.0-1
Diffstat (limited to 'src/nxt_conn_close.c')
-rw-r--r-- | src/nxt_conn_close.c | 14 |
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); } |