Skip to content

Commit

Permalink
deps: upgrade to libuv 1.37.0
Browse files Browse the repository at this point in the history
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: #32866
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Apr 28, 2020
1 parent 2d7a759 commit 6ffe4ed
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 21 deletions.
1 change: 1 addition & 0 deletions deps/uv/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -424,3 +424,4 @@ Lin Zhang <linroid@gmail.com>
Sk Sajidul Kadir <sheikh.sajid522@gmail.com>
twosee <twose@qq.com>
Rikard Falkeborn <rikard.falkeborn@gmail.com>
Yash Ladha <yashladhapankajladha123@gmail.com>
9 changes: 9 additions & 0 deletions deps/uv/ChangeLog
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
24 changes: 18 additions & 6 deletions deps/uv/docs/src/udp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/include/uv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
7 changes: 1 addition & 6 deletions deps/uv/src/timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
16 changes: 10 additions & 6 deletions deps/uv/src/unix/udp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -949,14 +947,17 @@ 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 */
domain = flags & 0xFF;
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) {
Expand All @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/uv-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6ffe4ed

Please sign in to comment.