diff options
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; } |