summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-03-21 16:55:02 +0300
committerMax Romanov <max.romanov@nginx.com>2018-03-21 16:55:02 +0300
commitb865db1bb74e821ff413a62089d699ed30905dd6 (patch)
treef79289311856e92a62072856e1ada0c682acb96b
parent82bb66993e73d2c4b984700b9fa6bcee6b3f2b2c (diff)
downloadunit-b865db1bb74e821ff413a62089d699ed30905dd6.tar.gz
unit-b865db1bb74e821ff413a62089d699ed30905dd6.tar.bz2
Registered RPC handlers affects port use counters.
Service process port gets closed and released by runtime on process exit, but there can be active RPC handlers, which uses port structure.
-rw-r--r--src/nxt_port_rpc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/nxt_port_rpc.c b/src/nxt_port_rpc.c
index 792bf55f..b53fbb78 100644
--- a/src/nxt_port_rpc.c
+++ b/src/nxt_port_rpc.c
@@ -143,6 +143,8 @@ nxt_port_rpc_register_handler_ex(nxt_task_t *task, nxt_port_t *port,
nxt_debug(task, "rpc: stream #%uD registered", stream);
+ nxt_port_inc_use(port);
+
return reg->data;
}
@@ -332,6 +334,8 @@ nxt_port_rpc_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
nxt_debug(task, "rpc: stream #%uD free registration", stream);
nxt_mp_free(port->mem_pool, reg);
+
+ nxt_port_use(task, port, -1);
}
@@ -421,6 +425,8 @@ nxt_port_rpc_remove_peer(nxt_task_t *task, nxt_port_t *port, nxt_pid_t peer)
}
nxt_mp_free(port->mem_pool, reg);
+
+ nxt_port_use(task, port, -1);
}
}
@@ -452,4 +458,6 @@ nxt_port_rpc_cancel(nxt_task_t *task, nxt_port_t *port, uint32_t stream)
nxt_debug(task, "rpc: stream #%uD cancel registration", stream);
nxt_mp_free(port->mem_pool, reg);
+
+ nxt_port_use(task, port, -1);
}