diff options
author | Marek Vavrusa <marek@vavrusa.com> | 2015-07-08 18:57:40 +0200 |
---|---|---|
committer | Saúl Ibarra Corretgé <s@saghul.net> | 2020-02-20 11:52:54 +0100 |
commit | 3d7136639a39db46bc4a9074922559a564e49514 (patch) | |
tree | dcb60123dd79248a3bdc0ecfe235d968a899759a /docs/src | |
parent | 56598f3d10fbb48705bba3149c995092d832bb62 (diff) | |
download | libuv-3d7136639a39db46bc4a9074922559a564e49514.tar.gz libuv-3d7136639a39db46bc4a9074922559a564e49514.zip |
freebsd,linux: add recvmmsg() + sendmmsg() udp implementation
This commits adds support for recvmmsg() and sendmmsg() extensions to
recvmsg() and sendmsg() that allows the caller to receive and send
multiple message from a socket using a single system call. This has
performance benefits for some applications.
Co-authored-by: Ondřej Surý <ondrej@sury.org>
Co-authored-by: Witold Kręcicki <wpk@culm.net>
PR-URL: https://github.com/libuv/libuv/pull/2532
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <s@saghul.net>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'docs/src')
-rw-r--r-- | docs/src/udp.rst | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/docs/src/udp.rst b/docs/src/udp.rst index 53b1fea4..2ca0736b 100644 --- a/docs/src/udp.rst +++ b/docs/src/udp.rst @@ -42,6 +42,12 @@ Data types * any traffic, in effect "stealing" the port from the previous listener. */ UV_UDP_REUSEADDR = 4 + /* + * Indicates that the message was received by recvmmsg and that it's not at + * the beginning of the buffer allocated by alloc_cb - so the buffer provided + * must not be freed by the recv_cb callback. + */ + UV_UDP_MMSG_CHUNK = 8 }; .. c:type:: void (*uv_udp_send_cb)(uv_udp_send_t* req, int status) @@ -62,12 +68,13 @@ Data types * `buf`: :c:type:`uv_buf_t` with the received data. * `addr`: ``struct sockaddr*`` containing the address of the sender. Can be NULL. Valid for the duration of the callback only. - * `flags`: One or more or'ed UV_UDP_* constants. Right now only - ``UV_UDP_PARTIAL`` is used. + * `flags`: One or more or'ed UV_UDP_* constants. The callee is responsible for freeing the buffer, libuv does not reuse it. The buffer may be a null buffer (where `buf->base` == NULL and `buf->len` == 0) - on error. + on error. Don't free the buffer when the UV_UDP_MMSG_CHUNK flag is set. + The final callback receives the whole buffer (containing the first chunk) + with the UV_UDP_MMSG_CHUNK flag cleared. .. note:: The receive callback will be called with `nread` == 0 and `addr` == NULL when there is |