diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-07-14 20:34:38 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-07-14 20:34:38 +0300 |
commit | b3464d563e699814d833d6ddf327d70660ddee6b (patch) | |
tree | 1bcfc0afa02dfc3d64505f8bd84e531a0092a0e0 /src/nxt_router.c | |
parent | b5d0920491780737b1c17ced7ac4521db6e57fc9 (diff) | |
download | unit-b3464d563e699814d833d6ddf327d70660ddee6b.tar.gz unit-b3464d563e699814d833d6ddf327d70660ddee6b.tar.bz2 |
Router: joint must be checked before memory pool destruction.
Diffstat (limited to 'src/nxt_router.c')
-rw-r--r-- | src/nxt_router.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c index c4679244..9500a9fb 100644 --- a/src/nxt_router.c +++ b/src/nxt_router.c @@ -1456,6 +1456,7 @@ nxt_router_listen_socket_release(nxt_task_t *task, static void nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint) { + nxt_bool_t exit; nxt_socket_conf_t *skcf; nxt_router_conf_t *rtcf; nxt_thread_spinlock_t *lock; @@ -1490,6 +1491,9 @@ nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint) /* TODO remove engine->port */ /* TODO excude from connected ports */ + /* The joint content can be used before memory pool destruction. */ + exit = nxt_queue_is_empty(&joint->engine->joints); + if (rtcf != NULL) { nxt_debug(task, "old router conf is destroyed"); @@ -1498,7 +1502,7 @@ nxt_router_conf_release(nxt_task_t *task, nxt_socket_conf_joint_t *joint) nxt_mp_destroy(rtcf->mem_pool); } - if (nxt_queue_is_empty(&joint->engine->joints)) { + if (exit) { nxt_thread_exit(task->thread); } } |