summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_main_process.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-09-15 20:30:24 +0300
committerMax Romanov <max.romanov@nginx.com>2017-09-15 20:30:24 +0300
commit0bec14878e99de280046e1d1b1a0195e5478c808 (patch)
treef5f40c8b9b4d1f3679d6daf38031002b4160d05b /src/nxt_main_process.c
parent90ae152ce0ace8f2c41a012b9fa52b2f3283a845 (diff)
downloadunit-0bec14878e99de280046e1d1b1a0195e5478c808.tar.gz
unit-0bec14878e99de280046e1d1b1a0195e5478c808.tar.bz2
Introducing application timeout.
Diffstat (limited to 'src/nxt_main_process.c')
-rw-r--r--src/nxt_main_process.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c
index 7748d07f..2e91628b 100644
--- a/src/nxt_main_process.c
+++ b/src/nxt_main_process.c
@@ -171,11 +171,14 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
nxt_mp_t *mp;
nxt_int_t ret;
nxt_buf_t *b;
+ nxt_port_t *port;
nxt_conf_value_t *conf;
nxt_common_app_conf_t app_conf;
static nxt_str_t nobody = nxt_string("nobody");
+ ret = NXT_ERROR;
+
b = msg->buf;
nxt_debug(task, "main start worker: %*s", b->mem.free - b->mem.pos,
@@ -196,7 +199,8 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
if (conf == NULL) {
nxt_log(task, NXT_LOG_CRIT, "configuration parsing error");
- return;
+
+ goto failed;
}
app_conf.user = nobody;
@@ -205,12 +209,24 @@ nxt_port_main_start_worker_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg)
nxt_nitems(nxt_common_app_conf), &app_conf);
if (ret != NXT_OK) {
nxt_log(task, NXT_LOG_CRIT, "root map error");
- return;
+
+ goto failed;
}
ret = nxt_main_start_worker_process(task, task->thread->runtime,
&app_conf, msg->port_msg.stream);
+failed:
+
+ if (ret == NXT_ERROR) {
+ port = nxt_runtime_port_find(task->thread->runtime, msg->port_msg.pid,
+ msg->port_msg.reply_port);
+ if (nxt_fast_path(port != NULL)) {
+ nxt_port_socket_write(task, port, NXT_PORT_MSG_RPC_ERROR,
+ -1, msg->port_msg.stream, 0, NULL);
+ }
+ }
+
nxt_mp_destroy(mp);
}