diff options
author | Max Romanov <max.romanov@nginx.com> | 2020-05-28 12:40:49 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2020-05-28 12:40:49 +0300 |
commit | 89b1e88f8f0b1d66a19ac9657c9568ef5fb0ff27 (patch) | |
tree | f69a9b93d4d62ac4c974d5c1a744293acbe225ca /src/nxt_port_socket.c | |
parent | fa4d4b61200b6f465edbe24ebcdce1a7a8675d39 (diff) | |
download | unit-89b1e88f8f0b1d66a19ac9657c9568ef5fb0ff27.tar.gz unit-89b1e88f8f0b1d66a19ac9657c9568ef5fb0ff27.tar.bz2 |
Closing unsent file descriptors from port queue.
After a process exits, all ports linked to it from other processes
should be closed. All unsent file descriptors in port queue, marked as
"close after send", should be closed to avoid resource leakage.
Diffstat (limited to 'src/nxt_port_socket.c')
-rw-r--r-- | src/nxt_port_socket.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/nxt_port_socket.c b/src/nxt_port_socket.c index 9c7da970..4e3eaef6 100644 --- a/src/nxt_port_socket.c +++ b/src/nxt_port_socket.c @@ -993,6 +993,12 @@ nxt_port_error_handler(nxt_task_t *task, void *obj, void *data) nxt_queue_each(msg, &port->messages, nxt_port_send_msg_t, link) { + if (msg->fd != -1 && msg->close_fd != 0) { + nxt_fd_close(msg->fd); + + msg->fd = -1; + } + for (b = msg->buf; b != NULL; b = next) { next = b->next; b->next = NULL; |