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.
This commit is contained in:
Max Romanov
2017-10-04 15:03:45 +03:00
parent 0faecee609
commit 00ecf713e3
9 changed files with 273 additions and 28 deletions

View File

@@ -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;
}