summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_sendbuf.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2017-10-04 15:03:45 +0300
committerMax Romanov <max.romanov@nginx.com>2017-10-04 15:03:45 +0300
commit00ecf713e36de2a5efffe761458b7ac0328bce87 (patch)
treed10e45f41d972326c4e5469a2cf4248a465514b6 /src/nxt_sendbuf.c
parent0faecee609b66a353d27499ca78ff6abcd3fef14 (diff)
downloadunit-00ecf713e36de2a5efffe761458b7ac0328bce87.tar.gz
unit-00ecf713e36de2a5efffe761458b7ac0328bce87.tar.bz2
Port message fragmentation supported.
- Each sendmsg() transmits no more than port->max_size payload data. - Longer buffers are fragmented and send using multiple sendmsg() calls. - On receive side, buffers are connected in chain. - Number of handler calls is the same as number of nxt_port_socket_write() calls. - nxt_buf_make_plain() function introduced to make single plain buffer from the chain.
Diffstat (limited to '')
-rw-r--r--src/nxt_sendbuf.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nxt_sendbuf.c b/src/nxt_sendbuf.c
index 2a529c14..1684f67c 100644
--- a/src/nxt_sendbuf.c
+++ b/src/nxt_sendbuf.c
@@ -111,7 +111,9 @@ nxt_sendbuf_mem_coalesce(nxt_task_t *task, nxt_sendbuf_coalesce_t *sb)
if (total + size > sb->limit) {
size = sb->limit - total;
- if (size == 0) {
+ sb->limit_reached = 1;
+
+ if (nxt_slow_path(size == 0)) {
break;
}
}
@@ -119,6 +121,8 @@ nxt_sendbuf_mem_coalesce(nxt_task_t *task, nxt_sendbuf_coalesce_t *sb)
if (b->mem.pos != last) {
if (++n >= sb->nmax) {
+ sb->nmax_reached = 1;
+
goto done;
}