diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-08-11 18:04:04 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-08-11 18:04:04 +0300 |
commit | 1b354421c33917239a793e891e3d43e02566e550 (patch) | |
tree | a7296360227a961c680b6a70f9e836ce691db646 | |
parent | 70d73d633bc92fca9fe311fdb1ba7af1b2599c9e (diff) | |
download | unit-1b354421c33917239a793e891e3d43e02566e550.tar.gz unit-1b354421c33917239a793e891e3d43e02566e550.tar.bz2 |
Tiny mmap buffers completion fixed.
Small mmap buffers transferred in 'plain' mode and should be freed by sender.
-rw-r--r-- | src/nxt_port_socket.c | 3 | ||||
-rw-r--r-- | src/nxt_sendbuf.c | 4 | ||||
-rw-r--r-- | src/nxt_sendbuf.h | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/nxt_port_socket.c b/src/nxt_port_socket.c index 01e46f93..de11549b 100644 --- a/src/nxt_port_socket.c +++ b/src/nxt_port_socket.c @@ -308,7 +308,8 @@ nxt_port_write_handler(nxt_task_t *task, void *obj, void *data) wq = &task->thread->engine->fast_work_queue; - msg->buf = nxt_sendbuf_completion(task, wq, msg->buf, plain_size); + msg->buf = nxt_sendbuf_completion(task, wq, msg->buf, plain_size, + m == NXT_PORT_METHOD_MMAP); if (msg->buf != NULL) { /* diff --git a/src/nxt_sendbuf.c b/src/nxt_sendbuf.c index 361cb0cd..2a529c14 100644 --- a/src/nxt_sendbuf.c +++ b/src/nxt_sendbuf.c @@ -373,7 +373,7 @@ nxt_sendbuf_update(nxt_buf_t *b, size_t sent) nxt_buf_t * nxt_sendbuf_completion(nxt_task_t *task, nxt_work_queue_t *wq, nxt_buf_t *b, - size_t sent) + size_t sent, nxt_bool_t mmap_mode) { size_t size; @@ -391,7 +391,7 @@ nxt_sendbuf_completion(nxt_task_t *task, nxt_work_queue_t *wq, nxt_buf_t *b, break; } - if (nxt_buf_is_port_mmap(b)) { + if (nxt_buf_is_port_mmap(b) && mmap_mode) { /* * buffer has been sent to other side which is now * responsible for shared memory bucket release diff --git a/src/nxt_sendbuf.h b/src/nxt_sendbuf.h index b159bfe5..03da2c5d 100644 --- a/src/nxt_sendbuf.h +++ b/src/nxt_sendbuf.h @@ -121,7 +121,7 @@ ssize_t nxt_sendbuf_copy_coalesce(nxt_conn_t *c, nxt_buf_mem_t *bm, nxt_buf_t *nxt_sendbuf_update(nxt_buf_t *b, size_t sent); nxt_buf_t *nxt_sendbuf_completion(nxt_task_t *task, nxt_work_queue_t *wq, - nxt_buf_t *b, size_t sent); + nxt_buf_t *b, size_t sent, nxt_bool_t mmap_mode); #endif /* _NXT_SENDBUF_H_INCLUDED_ */ |