summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-10-04 14:57:56 +0300
committerMax Romanov <max.romanov@nginx.com>2017-10-04 14:57:56 +0300
commitba311997866a4c2ef6ceeaac846832a85bd86f17 (patch)
tree74c268496a856065eec13b57db2a5158da2b6cd1 /src/nxt_runtime.c
parent4ae76249edb97775be8a0c749ad9ee79e3e85393 (diff)
downloadunit-ba311997866a4c2ef6ceeaac846832a85bd86f17.tar.gz
unit-ba311997866a4c2ef6ceeaac846832a85bd86f17.tar.bz2
Removing mem_pool from port_hash interface.
Memory pool is not used by port_hash and it was a mistake to pass it into 'add' and 'remove' functions. port_hash enrties are allocated from heap.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 886bd1ca..bfe62045 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -1586,16 +1586,21 @@ nxt_runtime_process_new(nxt_runtime_t *rt)
static void
nxt_runtime_process_destroy(nxt_runtime_t *rt, nxt_process_t *process)
{
+ nxt_port_t *port;
+ nxt_lvlhsh_each_t lhe;
+
nxt_assert(process->port_cleanups == 0);
nxt_assert(process->registered == 0);
nxt_port_mmaps_destroy(process->incoming, 1);
nxt_port_mmaps_destroy(process->outgoing, 1);
- if (process->cp_mem_pool != NULL) {
- nxt_mp_thread_adopt(process->cp_mem_pool);
+ port = nxt_port_hash_first(&process->connected_ports, &lhe);
+
+ while(port != NULL) {
+ nxt_port_hash_remove(&process->connected_ports, port);
- nxt_mp_destroy(process->cp_mem_pool);
+ port = nxt_port_hash_first(&process->connected_ports, &lhe);
}
nxt_thread_mutex_destroy(&process->incoming_mutex);
@@ -1847,7 +1852,7 @@ nxt_runtime_port_first(nxt_runtime_t *rt, nxt_lvlhsh_each_t *lhe)
void
nxt_runtime_port_add(nxt_runtime_t *rt, nxt_port_t *port)
{
- nxt_port_hash_add(&rt->ports, rt->mem_pool, port);
+ nxt_port_hash_add(&rt->ports, port);
rt->port_by_type[port->type] = port;
}
@@ -1856,7 +1861,7 @@ nxt_runtime_port_add(nxt_runtime_t *rt, nxt_port_t *port)
void
nxt_runtime_port_remove(nxt_runtime_t *rt, nxt_port_t *port)
{
- nxt_port_hash_remove(&rt->ports, rt->mem_pool, port);
+ nxt_port_hash_remove(&rt->ports, port);
if (rt->port_by_type[port->type] == port) {
rt->port_by_type[port->type] = NULL;