aboutsummaryrefslogtreecommitdiff
path: root/src/unix/udp.c
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2024-12-10 23:36:32 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2024-12-13 21:52:59 +0100
commite8969bff6cfebf950b2a52eabff53e53ff02ab0e (patch)
tree2129475b3a9082e9da228c127a7c811db81a1ec1 /src/unix/udp.c
parent7b4cf04a914116d998c5ebcbf2d53b6848b2f65e (diff)
downloadlibuv-e8969bff6cfebf950b2a52eabff53e53ff02ab0e.tar.gz
libuv-e8969bff6cfebf950b2a52eabff53e53ff02ab0e.zip
unix,win: add uv_udp_try_send2
Add a version of uv_udp_try_send that can send multiple datagrams. Uses sendmmsg(2) on platforms that support it (Linux, FreeBSD, macOS), falls back to a regular sendmsg(2) loop elsewhere. This work was sponsored by ISC, the Internet Systems Consortium.
Diffstat (limited to 'src/unix/udp.c')
-rw-r--r--src/unix/udp.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/unix/udp.c b/src/unix/udp.c
index 045e5fe8..67c01f7d 100644
--- a/src/unix/udp.c
+++ b/src/unix/udp.c
@@ -1401,3 +1401,18 @@ again:
feed:
uv__io_feed(handle->loop, &handle->io_watcher);
}
+
+
+int uv__udp_try_send2(uv_udp_t* handle,
+ unsigned int count,
+ uv_buf_t* bufs[/*count*/],
+ unsigned int nbufs[/*count*/],
+ struct sockaddr* addrs[/*count*/]) {
+ int fd;
+
+ fd = handle->io_watcher.fd;
+ if (fd == -1)
+ return UV_EINVAL;
+
+ return uv__udp_sendmsgv(fd, count, bufs, nbufs, addrs);
+}