diff options
author | Andrei Belov <defan@nginx.com> | 2019-03-01 18:30:09 +0300 |
---|---|---|
committer | Andrei Belov <defan@nginx.com> | 2019-03-01 18:30:09 +0300 |
commit | 3c3720cba7154bc168cbd00c74817626bb53e140 (patch) | |
tree | da1500f7c6bd5e90ecf45299b6f4b19a29d521cd /src/nxt_port_socket.c | |
parent | 315a864c27aa27a48c013c4a1ef67a099ffea894 (diff) | |
parent | df02b03824065389c73213b19736140442cf63bc (diff) | |
download | unit-3c3720cba7154bc168cbd00c74817626bb53e140.tar.gz unit-3c3720cba7154bc168cbd00c74817626bb53e140.tar.bz2 |
Merged with the default branch.
Diffstat (limited to 'src/nxt_port_socket.c')
-rw-r--r-- | src/nxt_port_socket.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/nxt_port_socket.c b/src/nxt_port_socket.c index a545013f..01fe2dab 100644 --- a/src/nxt_port_socket.c +++ b/src/nxt_port_socket.c @@ -179,6 +179,7 @@ nxt_port_msg_create(nxt_task_t *task, nxt_port_send_msg_t *m) msg->link.prev = NULL; msg->buf = m->buf; + msg->share = m->share; msg->fd = m->fd; msg->close_fd = m->close_fd; msg->port_msg = m->port_msg; @@ -799,6 +800,14 @@ nxt_port_read_msg_process(nxt_task_t *task, nxt_port_t *port, msg->buf = fmsg->buf; msg->fd = fmsg->fd; + + /* + * To disable instant completion or buffer re-usage, + * handler should reset 'msg.buf'. + */ + if (!msg->port_msg.mmap && msg->buf == b) { + nxt_port_buf_free(port, b); + } } } @@ -895,7 +904,7 @@ nxt_port_buf_alloc(nxt_port_t *port) static void nxt_port_buf_free(nxt_port_t *port, nxt_buf_t *b) { - b->next = port->free_bufs; + nxt_buf_chain_add(&b, port->free_bufs); port->free_bufs = b; } |