summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-03-13 15:32:06 +0300
committerMax Romanov <max.romanov@nginx.com>2018-03-13 15:32:06 +0300
commit1ac9db47501a1c5e4e023945ad60614b8fc3b52d (patch)
tree95d61beb07214eecabcf75ec2894e5ae1f338f14
parentee092b64ebbe1ae5d63e75ea2bee130aba6155bf (diff)
downloadunit-1ac9db47501a1c5e4e023945ad60614b8fc3b52d.tar.gz
unit-1ac9db47501a1c5e4e023945ad60614b8fc3b52d.tar.bz2
Releasing application on configuration failure.
Diffstat (limited to '')
-rw-r--r--src/nxt_router.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 787c6c3c..e5355612 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -985,6 +985,7 @@ static void
nxt_router_conf_error(nxt_task_t *task, nxt_router_temp_conf_t *tmcf)
{
nxt_app_t *app;
+ nxt_queue_t new_socket_confs;
nxt_socket_t s;
nxt_router_t *router;
nxt_queue_link_t *qlk;
@@ -1006,6 +1007,20 @@ nxt_router_conf_error(nxt_task_t *task, nxt_router_temp_conf_t *tmcf)
nxt_free(skcf->listen);
}
+ nxt_queue_init(&new_socket_confs);
+ nxt_queue_add(&new_socket_confs, &tmcf->updating);
+ nxt_queue_add(&new_socket_confs, &tmcf->pending);
+ nxt_queue_add(&new_socket_confs, &tmcf->creating);
+
+ nxt_queue_each(skcf, &new_socket_confs, nxt_socket_conf_t, link) {
+
+ if (skcf->application != NULL) {
+ nxt_router_app_use(task, skcf->application, -1);
+ skcf->application = NULL;
+ }
+
+ } nxt_queue_loop;
+
nxt_queue_each(app, &tmcf->apps, nxt_app_t, link) {
nxt_router_app_quit(task, app);