diff options
Diffstat (limited to 'src/nxt_main_process.c')
-rw-r--r-- | src/nxt_main_process.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/nxt_main_process.c b/src/nxt_main_process.c index 7548be9a..db1cfcb9 100644 --- a/src/nxt_main_process.c +++ b/src/nxt_main_process.c @@ -48,6 +48,8 @@ static void nxt_main_process_signal_handler(nxt_task_t *task, void *obj, static void nxt_main_process_cleanup(nxt_task_t *task, nxt_process_t *process); static void nxt_main_port_socket_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg); +static void nxt_main_port_socket_unlink_handler(nxt_task_t *task, + nxt_port_recv_msg_t *msg); static nxt_int_t nxt_main_listening_socket(nxt_sockaddr_t *sa, nxt_listening_socket_t *ls); static void nxt_main_port_modules_handler(nxt_task_t *task, @@ -587,6 +589,7 @@ static nxt_port_handlers_t nxt_main_process_port_handlers = { .remove_pid = nxt_port_remove_pid_handler, .start_process = nxt_main_start_process_handler, .socket = nxt_main_port_socket_handler, + .socket_unlink = nxt_main_port_socket_unlink_handler, .modules = nxt_main_port_modules_handler, .conf_store = nxt_main_port_conf_store_handler, #if (NXT_TLS) @@ -1214,6 +1217,49 @@ fail: } +static void +nxt_main_port_socket_unlink_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) +{ +#if (NXT_HAVE_UNIX_DOMAIN) + size_t i; + nxt_buf_t *b; + const char *filename; + nxt_runtime_t *rt; + nxt_sockaddr_t *sa; + nxt_listen_socket_t *ls; + + b = msg->buf; + sa = (nxt_sockaddr_t *) b->mem.pos; + + filename = sa->u.sockaddr_un.sun_path; + unlink(filename); + + rt = task->thread->runtime; + + for (i = 0; i < rt->listen_sockets->nelts; i++) { + const char *name; + + ls = (nxt_listen_socket_t *) rt->listen_sockets->elts + i; + sa = ls->sockaddr; + + if (sa->u.sockaddr.sa_family != AF_UNIX + || sa->u.sockaddr_un.sun_path[0] == '\0') + { + continue; + } + + name = sa->u.sockaddr_un.sun_path; + if (strcmp(name, filename) != 0) { + continue; + } + + nxt_array_remove(rt->listen_sockets, ls); + break; + } +#endif +} + + static nxt_conf_map_t nxt_app_lang_module_map[] = { { nxt_string("type"), |