summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_application.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_application.c')
-rw-r--r--src/nxt_application.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/nxt_application.c b/src/nxt_application.c
index c331764f..372a88b4 100644
--- a/src/nxt_application.c
+++ b/src/nxt_application.c
@@ -1263,7 +1263,7 @@ nxt_app_parse_type(u_char *p, size_t length)
nxt_int_t
nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init)
{
- nxt_port_t *my_port, *main_port;
+ nxt_port_t *my_port, *main_port, *router_port;
nxt_runtime_t *rt;
nxt_memzero(init, sizeof(nxt_unit_init_t));
@@ -1275,6 +1275,11 @@ nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init)
return NXT_ERROR;
}
+ router_port = rt->port_by_type[NXT_PROCESS_ROUTER];
+ if (nxt_slow_path(router_port == NULL)) {
+ return NXT_ERROR;
+ }
+
my_port = nxt_runtime_port_find(rt, nxt_pid, 0);
if (nxt_slow_path(my_port == NULL)) {
return NXT_ERROR;
@@ -1289,6 +1294,13 @@ nxt_unit_default_init(nxt_task_t *task, nxt_unit_init_t *init)
init->ready_stream = my_port->process->stream;
+ init->router_port.id.pid = router_port->pid;
+ init->router_port.id.id = router_port->id;
+ init->router_port.in_fd = -1;
+ init->router_port.out_fd = router_port->pair[1];
+
+ nxt_fd_blocking(task, router_port->pair[1]);
+
init->read_port.id.pid = my_port->pid;
init->read_port.id.id = my_port->id;
init->read_port.in_fd = my_port->pair[0];