From 6ffe4ed3b59aeed4905b40298a07d3da50b16382 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sun, 19 Apr 2020 12:26:58 -0400 Subject: [PATCH] deps: upgrade to libuv 1.37.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Notable changes: - The UV_UDP_RECVMMSG flag has been added. This flag is now required in order to utilize recvmmsg(). This was added in response to a regression introduced in 1.35.0 and 1.36.0. PR-URL: https://github.com/nodejs/node/pull/32866 Reviewed-By: James M Snell Reviewed-By: Richard Lau Reviewed-By: Anna Henningsen Reviewed-By: David Carlier Reviewed-By: Santiago Gimeno Reviewed-By: Ben Noordhuis Reviewed-By: Jiawen Geng Reviewed-By: Juan José Arboleda --- deps/uv/AUTHORS | 1 + deps/uv/ChangeLog | 9 +++++++++ deps/uv/configure.ac | 2 +- deps/uv/docs/src/udp.rst | 24 ++++++++++++++++++------ deps/uv/include/uv.h | 7 ++++++- deps/uv/include/uv/version.h | 2 +- deps/uv/src/timer.c | 7 +------ deps/uv/src/unix/udp.c | 16 ++++++++++------ deps/uv/src/uv-common.h | 1 + 9 files changed, 48 insertions(+), 21 deletions(-) diff --git a/deps/uv/AUTHORS b/deps/uv/AUTHORS index 17d67a64c6ca96..410d9461ad11d5 100644 --- a/deps/uv/AUTHORS +++ b/deps/uv/AUTHORS @@ -424,3 +424,4 @@ Lin Zhang Sk Sajidul Kadir twosee Rikard Falkeborn +Yash Ladha diff --git a/deps/uv/ChangeLog b/deps/uv/ChangeLog index 72484155c49039..3544c6c01b5a31 100644 --- a/deps/uv/ChangeLog +++ b/deps/uv/ChangeLog @@ -1,3 +1,12 @@ +2020.04.20, Version 1.37.0 (Stable), 02a9e1be252b623ee032a3137c0b0c94afbe6809 + +Changes since version 1.36.0: + +* timer: remove redundant check in heap compare (Yash Ladha) + +* udp: add flag to enable recvmmsg(2) explicitly (Saúl Ibarra Corretgé) + + 2020.04.16, Version 1.36.0 (Stable), 533b738838ad8407032e14b6772b29ef9af63cfa Changes since version 1.35.0: diff --git a/deps/uv/configure.ac b/deps/uv/configure.ac index e2564937b123d9..cd7bab08570c8f 100644 --- a/deps/uv/configure.ac +++ b/deps/uv/configure.ac @@ -13,7 +13,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_PREREQ(2.57) -AC_INIT([libuv], [1.36.0], [https://github.com/libuv/libuv/issues]) +AC_INIT([libuv], [1.37.0], [https://github.com/libuv/libuv/issues]) AC_CONFIG_MACRO_DIR([m4]) m4_include([m4/libuv-extra-automake-flags.m4]) m4_include([m4/as_case.m4]) diff --git a/deps/uv/docs/src/udp.rst b/deps/uv/docs/src/udp.rst index 786a28b0305849..6be20345280d90 100644 --- a/deps/uv/docs/src/udp.rst +++ b/deps/uv/docs/src/udp.rst @@ -41,12 +41,16 @@ Data types * (provided they all set the flag) but only the last one to bind will receive * any traffic, in effect "stealing" the port from the previous listener. */ - UV_UDP_REUSEADDR = 4 + UV_UDP_REUSEADDR = 4, /* * Indicates that the message was received by recvmmsg, so the buffer provided * must not be freed by the recv_cb callback. */ - UV_UDP_MMSG_CHUNK = 8 + UV_UDP_MMSG_CHUNK = 8, + /* + * Indicates that recvmmsg should be used, if available. + */ + UV_UDP_RECVMMSG = 256 }; .. c:type:: void (*uv_udp_send_cb)(uv_udp_send_t* req, int status) @@ -125,12 +129,17 @@ API .. c:function:: int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) - Initialize the handle with the specified flags. At the moment the lower 8 bits - of the `flags` parameter are used as the socket domain. A socket will be created - for the given domain. If the specified domain is ``AF_UNSPEC`` no socket is created, - just like :c:func:`uv_udp_init`. + Initialize the handle with the specified flags. The lower 8 bits of the `flags` + parameter are used as the socket domain. A socket will be created for the given domain. + If the specified domain is ``AF_UNSPEC`` no socket is created, just like :c:func:`uv_udp_init`. + + The remaining bits can be used to set one of these flags: + + * `UV_UDP_RECVMMSG`: if set, and the platform supports it, :man:`recvmmsg(2)` will + be used. .. versionadded:: 1.7.0 + .. versionchanged:: 1.37.0 added the `UV_UDP_RECVMMSG` flag. .. c:function:: int uv_udp_open(uv_udp_t* handle, uv_os_sock_t sock) @@ -379,6 +388,9 @@ API .. versionchanged:: 1.35.0 added support for :man:`recvmmsg(2)` on supported platforms). The use of this feature requires a buffer larger than 2 * 64KB to be passed to `alloc_cb`. + .. versionchanged:: 1.37.0 :man:`recvmmsg(2)` support is no longer enabled implicitly, + it must be explicitly requested by passing the `UV_UDP_RECVMMSG` flag to + :c:func:`uv_udp_init_ex`. .. c:function:: int uv_udp_recv_stop(uv_udp_t* handle) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index 2e8072fdaed1f4..a3a770db88b90e 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -610,7 +610,12 @@ enum uv_udp_flags { * Indicates that the message was received by recvmmsg, so the buffer provided * must not be freed by the recv_cb callback. */ - UV_UDP_MMSG_CHUNK = 8 + UV_UDP_MMSG_CHUNK = 8, + + /* + * Indicates that recvmmsg should be used, if available. + */ + UV_UDP_RECVMMSG = 256 }; typedef void (*uv_udp_send_cb)(uv_udp_send_t* req, int status); diff --git a/deps/uv/include/uv/version.h b/deps/uv/include/uv/version.h index 537835ae1f271a..be97adf6fff794 100644 --- a/deps/uv/include/uv/version.h +++ b/deps/uv/include/uv/version.h @@ -31,7 +31,7 @@ */ #define UV_VERSION_MAJOR 1 -#define UV_VERSION_MINOR 36 +#define UV_VERSION_MINOR 37 #define UV_VERSION_PATCH 0 #define UV_VERSION_IS_RELEASE 1 #define UV_VERSION_SUFFIX "" diff --git a/deps/uv/src/timer.c b/deps/uv/src/timer.c index 9da513fc0c9e40..4cf4ed42648650 100644 --- a/deps/uv/src/timer.c +++ b/deps/uv/src/timer.c @@ -51,12 +51,7 @@ static int timer_less_than(const struct heap_node* ha, /* Compare start_id when both have the same timeout. start_id is * allocated with loop->timer_counter in uv_timer_start(). */ - if (a->start_id < b->start_id) - return 1; - if (b->start_id < a->start_id) - return 0; - - return 0; + return a->start_id < b->start_id; } diff --git a/deps/uv/src/unix/udp.c b/deps/uv/src/unix/udp.c index f2fcae1760f40c..3aa11c5beeb4ad 100644 --- a/deps/uv/src/unix/udp.c +++ b/deps/uv/src/unix/udp.c @@ -262,11 +262,9 @@ static void uv__udp_recvmsg(uv_udp_t* handle) { assert(buf.base != NULL); #if HAVE_MMSG - uv_once(&once, uv__udp_mmsg_init); - if (uv__recvmmsg_avail) { - /* Returned space for more than 1 datagram, use it to receive - * multiple datagrams. */ - if (buf.len >= 2 * UV__UDP_DGRAM_MAXSIZE) { + if (handle->flags & UV_HANDLE_UDP_RECVMMSG) { + uv_once(&once, uv__udp_mmsg_init); + if (uv__recvmmsg_avail) { nread = uv__udp_recvmmsg(handle, &buf); if (nread > 0) count -= nread; @@ -949,6 +947,7 @@ static int uv__udp_set_source_membership6(uv_udp_t* handle, int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { int domain; int err; + int extra_flags; int fd; /* Use the lower 8 bits for the domain */ @@ -956,7 +955,9 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { if (domain != AF_INET && domain != AF_INET6 && domain != AF_UNSPEC) return UV_EINVAL; - if (flags & ~0xFF) + /* Use the higher bits for extra flags */ + extra_flags = flags & ~0xFF; + if (extra_flags & ~UV_UDP_RECVMMSG) return UV_EINVAL; if (domain != AF_UNSPEC) { @@ -977,6 +978,9 @@ int uv_udp_init_ex(uv_loop_t* loop, uv_udp_t* handle, unsigned int flags) { QUEUE_INIT(&handle->write_queue); QUEUE_INIT(&handle->write_completed_queue); + if (extra_flags & UV_UDP_RECVMMSG) + handle->flags |= UV_HANDLE_UDP_RECVMMSG; + return 0; } diff --git a/deps/uv/src/uv-common.h b/deps/uv/src/uv-common.h index 13192c1ebd8814..f08fb8ae091e72 100644 --- a/deps/uv/src/uv-common.h +++ b/deps/uv/src/uv-common.h @@ -104,6 +104,7 @@ enum { /* Only used by uv_udp_t handles. */ UV_HANDLE_UDP_PROCESSING = 0x01000000, UV_HANDLE_UDP_CONNECTED = 0x02000000, + UV_HANDLE_UDP_RECVMMSG = 0x04000000, /* Only used by uv_pipe_t handles. */ UV_HANDLE_NON_OVERLAPPED_PIPE = 0x01000000,