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.
This commit is contained in:
Max Romanov
2017-07-07 16:01:34 +03:00
parent 61008a7c0b
commit 74cda90e31
11 changed files with 113 additions and 22 deletions

View File

@@ -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);
@@ -291,6 +291,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)
{