summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
committerMax Romanov <max.romanov@nginx.com>2020-10-28 00:01:46 +0300
commit779b1131c56539ed74ab9db9a03f7bff71e203ba (patch)
treed06fbfe739e0bb664fd955dee0faa08209dced43
parent8956e668cc3b4088a7bdd3d82ca99ac1445c8814 (diff)
downloadunit-779b1131c56539ed74ab9db9a03f7bff71e203ba.tar.gz
unit-779b1131c56539ed74ab9db9a03f7bff71e203ba.tar.bz2
Router: closing app worker's ports.
-rw-r--r--src/nxt_router.c19
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);