summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-07-18 00:21:14 +0300
committerMax Romanov <max.romanov@nginx.com>2017-07-18 00:21:14 +0300
commiteb675f2d78178b2cdd54d934022f9b739bfa8952 (patch)
tree0b072c752fff35cd5c4498cded7016a5738caa58 /src/nxt_runtime.c
parent47b359388cdf6348238e7fc05770426448049189 (diff)
downloadunit-eb675f2d78178b2cdd54d934022f9b739bfa8952.tar.gz
unit-eb675f2d78178b2cdd54d934022f9b739bfa8952.tar.bz2
Port allocation and destroy changed. Worker process stop introduced.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 6ddf27c1..8b216337 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -1542,7 +1542,6 @@ nxt_runtime_process_find(nxt_runtime_t *rt, nxt_pid_t pid)
lhq.proto = &lvlhsh_processes_proto;
if (nxt_lvlhsh_find(&rt->processes, &lhq) == NXT_OK) {
- nxt_thread_log_debug("process %PI found", pid);
return lhq.value;
}
@@ -1662,9 +1661,13 @@ nxt_runtime_process_remove(nxt_runtime_t *rt, nxt_process_t *process)
nxt_runtime_port_remove(rt, port);
+ nxt_port_release(port);
+
} nxt_process_port_loop;
- nxt_runtime_process_destroy(rt, process);
+ if (nxt_queue_is_empty(&process->ports)) {
+ nxt_runtime_process_destroy(rt, process);
+ }
break;
@@ -1709,24 +1712,6 @@ nxt_runtime_port_remove(nxt_runtime_t *rt, nxt_port_t *port)
if (rt->port_by_type[port->type] == port) {
rt->port_by_type[port->type] = NULL;
}
-
- if (port->pair[0] != -1) {
- nxt_fd_close(port->pair[0]);
- }
-
- if (port->pair[1] != -1) {
- nxt_fd_close(port->pair[1]);
- }
-
- if (port->type == NXT_PROCESS_WORKER) {
- nxt_router_app_remove_port(port);
- }
-
- if (port->mem_pool) {
- nxt_mp_destroy(port->mem_pool);
- }
-
- nxt_mp_free(rt->mem_pool, port);
}