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

@@ -250,6 +250,19 @@ NXT_EXPORT nxt_buf_t *nxt_buf_sync_alloc(nxt_mp_t *mp, nxt_uint_t flags);
NXT_EXPORT nxt_int_t nxt_buf_ts_handle(nxt_task_t *task, void *obj, void *data);
NXT_EXPORT nxt_buf_t *nxt_buf_make_plain(nxt_mp_t *mp, nxt_buf_t *src,
size_t size);
nxt_inline nxt_buf_t *
nxt_buf_chk_make_plain(nxt_mp_t *mp, nxt_buf_t *src, size_t size)
{
if (nxt_slow_path(src != NULL && src->next != NULL)) {
return nxt_buf_make_plain(mp, src, size);
}
return src;
}
#define \
nxt_buf_free(mp, b) \
nxt_mp_free((mp), (b))