diff options
author | Igor Sysoev <igor@sysoev.ru> | 2018-06-18 17:14:30 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2018-06-18 17:14:30 +0300 |
commit | cb36b076868496790a1386046c912fa5a2a20866 (patch) | |
tree | 6aa34fd5ae23168b5eb3e4f1506323dc10607774 | |
parent | 6273819080584460db7a7a65fc69c3f92a84b05b (diff) | |
download | unit-cb36b076868496790a1386046c912fa5a2a20866.tar.gz unit-cb36b076868496790a1386046c912fa5a2a20866.tar.bz2 |
Removing Unix control socket on start failure.
The bug had appeared in 5cc5002a788e when process type has been
converted to bitmask. This commit reverts the type back to a number.
This commit is related to #131 issue on GitHub.
-rw-r--r-- | src/nxt_main_process.c | 2 | ||||
-rw-r--r-- | src/nxt_port.c | 2 | ||||
-rw-r--r-- | src/nxt_process.c | 4 | ||||
-rw-r--r-- | src/nxt_runtime.c | 4 | ||||
-rw-r--r-- | src/nxt_runtime.h | 16 |
5 files changed, 5 insertions, 23 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index e80034c4..71a871df 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -80,7 +80,7 @@ nxt_int_t nxt_main_process_start(nxt_thread_t *thr, nxt_task_t *task, nxt_runtime_t *rt) { - rt->types |= (1U << NXT_PROCESS_MAIN); + rt->type = NXT_PROCESS_MAIN; if (nxt_main_process_port_create(task, rt) != NXT_OK) { return NXT_ERROR; diff --git a/src/nxt_port.c b/src/nxt_port.c index 7e5722d0..6ccdfab5 100644 --- a/src/nxt_port.c +++ b/src/nxt_port.c @@ -306,8 +306,6 @@ nxt_port_process_ready_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) rt = task->thread->runtime; - nxt_assert(nxt_runtime_is_main(rt)); - process = nxt_runtime_process_find(rt, msg->port_msg.pid); if (nxt_slow_path(process == NULL)) { return; diff --git a/src/nxt_process.c b/src/nxt_process.c index beb33f63..3f9de6fb 100644 --- a/src/nxt_process.c +++ b/src/nxt_process.c @@ -62,8 +62,6 @@ nxt_process_create(nxt_task_t *task, nxt_process_t *process) process->pid = nxt_pid; - rt->types = 0; - ptype = process->init->type; nxt_port_reset_next_id(); @@ -149,7 +147,7 @@ nxt_process_start(nxt_task_t *task, nxt_process_t *process) rt = thread->runtime; - rt->types |= (1U << init->type); + rt->type = init->type; engine = thread->engine; diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c index 9ecad82f..849499d8 100644 --- a/src/nxt_runtime.c +++ b/src/nxt_runtime.c @@ -433,7 +433,7 @@ nxt_runtime_quit(nxt_task_t *task) done = 0; } - if (nxt_runtime_is_main(rt)) { + if (rt->type == NXT_PROCESS_MAIN) { nxt_main_stop_worker_processes(task, rt); done = 0; } @@ -490,7 +490,7 @@ nxt_runtime_exit(nxt_task_t *task, void *obj, void *data) return; } - if (nxt_runtime_is_main(rt)) { + if (rt->type == NXT_PROCESS_MAIN) { if (rt->pid_file != NULL) { nxt_file_delete(rt->pid_file); } diff --git a/src/nxt_runtime.h b/src/nxt_runtime.h index d0546e63..c23e4bce 100644 --- a/src/nxt_runtime.h +++ b/src/nxt_runtime.h @@ -43,7 +43,7 @@ struct nxt_runtime_s { uint32_t last_engine_id; - uint32_t types; /* bitset of nxt_process_type_t */ + nxt_process_type_t type; nxt_timer_t timer; @@ -83,20 +83,6 @@ nxt_int_t nxt_runtime_thread_pool_create(nxt_thread_t *thr, nxt_runtime_t *rt, nxt_uint_t max_threads, nxt_nsec_t timeout); -nxt_inline nxt_bool_t -nxt_runtime_is_type(nxt_runtime_t *rt, nxt_process_type_t type) -{ - return (rt->types & (1U << type)) != 0; -} - - -nxt_inline nxt_bool_t -nxt_runtime_is_main(nxt_runtime_t *rt) -{ - return nxt_runtime_is_type(rt, NXT_PROCESS_MAIN); -} - - nxt_process_t *nxt_runtime_process_new(nxt_runtime_t *rt); nxt_process_t *nxt_runtime_process_get(nxt_runtime_t *rt, nxt_pid_t pid); |