summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-03-07 19:42:06 +0300
committerMax Romanov <max.romanov@nginx.com>2018-03-07 19:42:06 +0300
commitee092b64ebbe1ae5d63e75ea2bee130aba6155bf (patch)
tree2e15b71b2c6f2f8c5d4f4e7d2c2e20e8c8e59739
parent4f712e3fd0c2c8f1e91b11dce5596b995ef69985 (diff)
downloadunit-ee092b64ebbe1ae5d63e75ea2bee130aba6155bf.tar.gz
unit-ee092b64ebbe1ae5d63e75ea2bee130aba6155bf.tar.bz2
Socket configuration should retain application.
This retains application during reconfiguration if an incoming connection was already established before the reconfiguration, but no request was yet created for the connection and thus no application was yet assigned to the request.
-rw-r--r--src/nxt_router.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 0afef978..787c6c3c 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1443,6 +1443,7 @@ nxt_router_conf_create(nxt_task_t *task, nxt_router_temp_conf_t *tmcf,
skcf->router_conf->count++;
skcf->application = nxt_router_listener_application(tmcf,
&lscf.application);
+ nxt_router_app_use(task, skcf->application, 1);
}
nxt_queue_add(&tmcf->deleting, &router->sockets);
@@ -2510,6 +2511,7 @@ nxt_router_listen_socket_release(nxt_task_t *task, nxt_socket_conf_t *skcf)
static void
nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint)
{
+ nxt_app_t *app;
nxt_socket_conf_t *skcf;
nxt_router_conf_t *rtcf;
nxt_event_engine_t *engine;
@@ -2531,6 +2533,7 @@ nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint)
engine = joint->engine;
skcf = joint->socket_conf;
+ app = skcf->application;
rtcf = skcf->router_conf;
lock = &rtcf->router->lock;
@@ -2541,6 +2544,7 @@ nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint)
if (--skcf->count != 0) {
rtcf = NULL;
+ app = NULL;
} else {
nxt_queue_remove(&skcf->link);
@@ -2552,6 +2556,10 @@ nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint)
nxt_thread_spin_unlock(lock);
+ if (app != NULL) {
+ nxt_router_app_use(task, app, -1);
+ }
+
/* TODO remove engine->port */
/* TODO excude from connected ports */