Added mem_pool pointer member to nxt_port_send_msg_t.

To decouple nxt_port_send_msg_t from port.
This commit is contained in:
Max Romanov
2017-06-23 19:20:08 +03:00
parent eaf28db46e
commit 3b9aa27625
2 changed files with 3 additions and 1 deletions

View File

@@ -36,6 +36,7 @@ typedef struct {
typedef struct { typedef struct {
nxt_queue_link_t link; nxt_queue_link_t link;
nxt_buf_t *buf; nxt_buf_t *buf;
nxt_mp_t *mem_pool;
size_t share; size_t share;
nxt_fd_t fd; nxt_fd_t fd;
nxt_port_msg_t port_msg; nxt_port_msg_t port_msg;

View File

@@ -167,6 +167,7 @@ nxt_port_socket_write(nxt_task_t *task, nxt_port_t *port, nxt_uint_t type,
msg->buf = b; msg->buf = b;
msg->fd = fd; msg->fd = fd;
msg->share = 0; msg->share = 0;
msg->mem_pool = port->mem_pool;
msg->port_msg.stream = stream; msg->port_msg.stream = stream;
msg->port_msg.pid = nxt_pid; msg->port_msg.pid = nxt_pid;
@@ -289,7 +290,7 @@ nxt_port_write_handler(nxt_task_t *task, void *obj, void *data)
} else { } else {
nxt_queue_remove(link); nxt_queue_remove(link);
nxt_mp_free(port->mem_pool, msg); nxt_mp_free(msg->mem_pool, msg);
} }
} else if (nxt_slow_path(n == NXT_ERROR)) { } else if (nxt_slow_path(n == NXT_ERROR)) {