diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-11-27 17:52:28 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-11-27 17:52:28 +0300 |
commit | 80e8ce832265477693b4ec183f1ee63d89d1c90d (patch) | |
tree | 7e3325ac9ac743e6c8485df3406959323c041ad2 | |
parent | 863377441bdc70885d1bad80bbbd9c6a9a3646a7 (diff) | |
download | unit-80e8ce832265477693b4ec183f1ee63d89d1c90d.tar.gz unit-80e8ce832265477693b4ec183f1ee63d89d1c90d.tar.bz2 |
A number of engine connections is decreased on connection close.
-rw-r--r-- | src/nxt_conn.c | 9 | ||||
-rw-r--r-- | src/nxt_conn.h | 1 | ||||
-rw-r--r-- | src/nxt_controller.c | 4 | ||||
-rw-r--r-- | src/nxt_router.c | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/src/nxt_conn.c b/src/nxt_conn.c index a5549eda..9d30fcfd 100644 --- a/src/nxt_conn.c +++ b/src/nxt_conn.c @@ -94,6 +94,15 @@ nxt_conn_create(nxt_mp_t *mp, nxt_task_t *task) void +nxt_conn_free(nxt_task_t *task, nxt_conn_t *c) +{ + task->thread->engine->connections--; + + nxt_mp_release(c->mem_pool, c); +} + + +void nxt_conn_io_shutdown(nxt_task_t *task, void *obj, void *data) { int ret; diff --git a/src/nxt_conn.h b/src/nxt_conn.h index e3204bfa..d2f3db3b 100644 --- a/src/nxt_conn.h +++ b/src/nxt_conn.h @@ -224,6 +224,7 @@ struct nxt_conn_s { NXT_EXPORT nxt_conn_t *nxt_conn_create(nxt_mp_t *mp, nxt_task_t *task); +NXT_EXPORT void nxt_conn_free(nxt_task_t *task, nxt_conn_t *c); void nxt_conn_io_shutdown(nxt_task_t *task, void *obj, void *data); NXT_EXPORT void nxt_conn_close(nxt_event_engine_t *engine, nxt_conn_t *c); diff --git a/src/nxt_controller.c b/src/nxt_controller.c index 78da02a8..be7bfd5d 100644 --- a/src/nxt_controller.c +++ b/src/nxt_controller.c @@ -721,9 +721,7 @@ nxt_controller_conn_free(nxt_task_t *task, void *obj, void *data) nxt_sockaddr_cache_free(task->thread->engine, c); - nxt_mp_destroy(c->mem_pool); - - //nxt_free(c); + nxt_conn_free(task, c); } diff --git a/src/nxt_router.c b/src/nxt_router.c index 1a9ec32c..e29dc572 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -3662,7 +3662,7 @@ nxt_router_conn_free(nxt_task_t *task, void *obj, void *data) nxt_mp_cleanup(c->mem_pool, nxt_router_conn_mp_cleanup, &engine->task, joint, NULL); - nxt_mp_release(c->mem_pool, c); + nxt_conn_free(task, c); } |