diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-07-07 16:01:34 +0300 |
commit | f319220a6c4515f3d31e546b4f1f5de0b94aceb7 (patch) | |
tree | eb4a3ed43d9d7ebef794e51fba56715e65b5a936 /src/nxt_port.c | |
parent | c9fbd832ab4f5743824b155fb3bf3a42206fdd52 (diff) | |
download | unit-f319220a6c4515f3d31e546b4f1f5de0b94aceb7.tar.gz unit-f319220a6c4515f3d31e546b4f1f5de0b94aceb7.tar.bz2 |
Redirecting buffer completion handler to specific engine.
There is a case in router where we use port in router connection thread.
Buffers are allocated within connection memory pool which can be used only in
this router thread. sendmsg() can be postponed into main router thread and
completion handler will compare current engine and post itself to correct
engine.
Diffstat (limited to 'src/nxt_port.c')
-rw-r--r-- | src/nxt_port.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/nxt_port.c b/src/nxt_port.c index 91f0fe31..249a287c 100644 --- a/src/nxt_port.c +++ b/src/nxt_port.c @@ -10,8 +10,6 @@ static void nxt_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg); -static void nxt_port_new_port_buf_completion(nxt_task_t *task, void *obj, - void *data); void @@ -102,13 +100,10 @@ nxt_port_send_new_port(nxt_task_t *task, nxt_runtime_t *rt, nxt_int_t nxt_port_send_port(nxt_task_t *task, nxt_port_t *port, nxt_port_t *new_port) { - nxt_mp_t *mp; nxt_buf_t *b; nxt_port_msg_new_port_t *msg; - mp = port->mem_pool; - - b = nxt_buf_mem_alloc(mp, sizeof(nxt_port_data_t), 0); + b = nxt_buf_mem_ts_alloc(task, port->mem_pool, sizeof(nxt_port_data_t)); if (nxt_slow_path(b == NULL)) { return NXT_ERROR; } @@ -116,8 +111,6 @@ nxt_port_send_port(nxt_task_t *task, nxt_port_t *port, nxt_port_t *new_port) nxt_debug(task, "send port %FD to process %PI", new_port->pair[1], port->pid); - b->data = mp; - b->completion_handler = nxt_port_new_port_buf_completion; b->mem.free += sizeof(nxt_port_msg_new_port_t); msg = (nxt_port_msg_new_port_t *) b->mem.pos; @@ -133,19 +126,6 @@ nxt_port_send_port(nxt_task_t *task, nxt_port_t *port, nxt_port_t *new_port) } -static void -nxt_port_new_port_buf_completion(nxt_task_t *task, void *obj, void *data) -{ - nxt_mp_t *mp; - nxt_buf_t *b; - - b = obj; - mp = b->data; - - nxt_buf_free(mp, b); -} - - void nxt_port_new_port_handler(nxt_task_t *task, nxt_port_recv_msg_t *msg) { |