summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_port.c
diff options
context:
space:
mode:
authorTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
committerTiago Natel de Moura <t.nateldemoura@f5.com>2021-11-09 15:48:44 +0300
commit1de660b6df93c09719361e364211c7c6388c01ce (patch)
tree8333001eb6c335f9c08836c7e2293eea5912b95c /src/nxt_port.c
parentff6a7053f500414dc74568a4e49adbac7f0cf634 (diff)
downloadunit-1de660b6df93c09719361e364211c7c6388c01ce.tar.gz
unit-1de660b6df93c09719361e364211c7c6388c01ce.tar.bz2
Changed nxt_process_* for reuse.
This enables the reuse of process creation functions.
Diffstat (limited to 'src/nxt_port.c')
-rw-r--r--src/nxt_port.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/nxt_port.c b/src/nxt_port.c
index d4e46564..d6b33f71 100644
--- a/src/nxt_port.c
+++ b/src/nxt_port.c
@@ -448,6 +448,53 @@ nxt_port_data_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
void
+nxt_port_remove_notify_others(nxt_task_t *task, nxt_process_t *process)
+{
+ nxt_pid_t pid;
+ nxt_buf_t *buf;
+ nxt_port_t *port;
+ nxt_runtime_t *rt;
+ nxt_process_t *p;
+ nxt_process_type_t ptype;
+
+ pid = process->pid;
+
+ ptype = nxt_process_type(process);
+
+ rt = task->thread->runtime;
+
+ nxt_runtime_process_each(rt, p) {
+
+ if (p->pid == nxt_pid
+ || p->pid == pid
+ || nxt_queue_is_empty(&p->ports))
+ {
+ continue;
+ }
+
+ port = nxt_process_port_first(p);
+
+ if (nxt_proc_remove_notify_matrix[ptype][port->type] == 0) {
+ continue;
+ }
+
+ buf = nxt_buf_mem_ts_alloc(task, task->thread->engine->mem_pool,
+ sizeof(pid));
+
+ if (nxt_slow_path(buf == NULL)) {
+ continue;
+ }
+
+ buf->mem.free = nxt_cpymem(buf->mem.free, &pid, sizeof(pid));
+
+ nxt_port_socket_write(task, port, NXT_PORT_MSG_REMOVE_PID, -1,
+ process->stream, 0, buf);
+
+ } nxt_runtime_process_loop;
+}
+
+
+void
nxt_port_remove_pid_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
{
nxt_buf_t *buf;