summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-09-15 12:27:24 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-09-15 12:27:24 +0300
commit7c1db309940cce607bfef713e7561cf627939f0c (patch)
tree5767a512276e07570fc54371217486a40d5bbde7
parent309ba5abf2aa51a35c744e7cfe7cb537b3074b42 (diff)
downloadunit-7c1db309940cce607bfef713e7561cf627939f0c.tar.gz
unit-7c1db309940cce607bfef713e7561cf627939f0c.tar.bz2
Router: more logical code order change.
Updating the router engines list before posting jobs to worker thread engines is more logical because worker threads may exit after the posting. However, the previous code was safe because an engine is freed by the router main thread after worker its thread has exited.
-rw-r--r--src/nxt_router.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nxt_router.c b/src/nxt_router.c
index 26533266..b328c632 100644
--- a/src/nxt_router.c
+++ b/src/nxt_router.c
@@ -1548,8 +1548,6 @@ nxt_router_engines_post(nxt_router_t *router, nxt_router_temp_conf_t *tmcf)
for (n = tmcf->engines->nelts; n != 0; n--) {
engine = recf->engine;
- nxt_router_engine_post(engine, recf->jobs);
-
switch (recf->action) {
case NXT_ROUTER_ENGINE_KEEP:
@@ -1564,6 +1562,8 @@ nxt_router_engines_post(nxt_router_t *router, nxt_router_temp_conf_t *tmcf)
break;
}
+ nxt_router_engine_post(engine, recf->jobs);
+
recf++;
}
}