summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_port.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-07-07 16:01:34 +0300
committerMax Romanov <max.romanov@nginx.com>2017-07-07 16:01:34 +0300
commit74cda90e31f97ba0ebd6483f2b073c1240b93a58 (patch)
tree69727640f476822e3cc1e40ac09bf645251617be /src/nxt_port.c
parent61008a7c0b45fe55f3f611c61f81e569e6baee30 (diff)
downloadunit-74cda90e31f97ba0ebd6483f2b073c1240b93a58.tar.gz
unit-74cda90e31f97ba0ebd6483f2b073c1240b93a58.tar.bz2
Process stop notification from master to all other processes.
New port message type introduced NXT_PORT_MSG_REMOVE_PID. Default handler removes process description from nxt_runtime_t with all ports, incoming and outgoing mmaps etc.
Diffstat (limited to '')
-rw-r--r--src/nxt_port.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/nxt_port.c b/src/nxt_port.c
index 249a287c..404e6424 100644
--- a/src/nxt_port.c
+++ b/src/nxt_port.c
@@ -52,7 +52,7 @@ nxt_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
{
nxt_port_handler_t *handlers;
- if (nxt_fast_path(msg->port_msg.type <= NXT_PORT_MSG_MAX)) {
+ if (nxt_fast_path(msg->port_msg.type < NXT_PORT_MSG_MAX)) {
nxt_debug(task, "port %d: message type:%uD",
msg->port->socket.fd, msg->port_msg.type);
@@ -292,6 +292,26 @@ nxt_port_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
void
+nxt_port_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
+{
+ nxt_pid_t pid;
+ nxt_runtime_t *rt;
+ nxt_process_t *process;
+
+ nxt_debug(task, "port remove pid handler");
+
+ rt = task->thread->runtime;
+ pid = msg->port_msg.stream;
+
+ process = nxt_runtime_process_find(rt, pid);
+
+ if (process) {
+ nxt_runtime_process_remove(rt, process);
+ }
+}
+
+
+void
nxt_port_empty_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
{
nxt_debug(task, "port empty handler");