summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_buf.h
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_buf.h
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 'src/nxt_buf.h')
-rw-r--r--src/nxt_buf.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/nxt_buf.h b/src/nxt_buf.h
index 2e896093..7a894d0f 100644
--- a/src/nxt_buf.h
+++ b/src/nxt_buf.h
@@ -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))