diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-10-28 00:01:46 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-10-28 00:01:46 +0300 |
commit | 779b1131c56539ed74ab9db9a03f7bff71e203ba (patch) | |
tree | d06fbfe739e0bb664fd955dee0faa08209dced43 | |
parent | 8956e668cc3b4088a7bdd3d82ca99ac1445c8814 (diff) | |
download | unit-779b1131c56539ed74ab9db9a03f7bff71e203ba.tar.gz unit-779b1131c56539ed74ab9db9a03f7bff71e203ba.tar.bz2 |
Router: closing app worker's ports.
-rw-r--r-- | src/nxt_router.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index a3218047..bbd9a54e 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -4667,6 +4667,25 @@ nxt_router_free_app(nxt_task_t *task, void *obj, void *data) nxt_port_use(task, port, -1); } + nxt_thread_mutex_lock(&app->mutex); + + for ( ;; ) { + port = nxt_port_hash_retrieve(&app->port_hash); + if (port == NULL) { + break; + } + + app->port_hash_count--; + + port->app = NULL; + + nxt_port_close(task, port); + + nxt_port_use(task, port, -1); + } + + nxt_thread_mutex_unlock(&app->mutex); + nxt_assert(app->processes == 0); nxt_assert(app->active_requests == 0); nxt_assert(app->port_hash_count == 0); |