Compare commits

...

1 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
14403a8f63 unix,tcp: allow 0 delay in uv_tcp_keepalive
The removed check was introduced in
https://github.com/libuv/libuv/pull/4272 but it breaks previously
working (and documented) behavior: https://nodejs.org/api/net.html#socketsetkeepaliveenable-initialdelay
2024-03-11 09:19:20 +01:00
2 changed files with 7 additions and 4 deletions

View File

@ -467,9 +467,6 @@ int uv__tcp_keepalive(int fd, int on, unsigned int delay) {
if (!on)
return 0;
if (delay == 0)
return -1;
#ifdef __sun
/* The implementation of TCP keep-alive on Solaris/SmartOS is a bit unusual
* compared to other Unix-like systems.

View File

@ -33,7 +33,7 @@ TEST_IMPL(tcp_flags) {
loop = uv_default_loop();
r = uv_tcp_init(loop, &handle);
r = uv_tcp_init_ex(loop, &handle, AF_INET);
ASSERT_OK(r);
r = uv_tcp_nodelay(&handle, 1);
@ -42,6 +42,12 @@ TEST_IMPL(tcp_flags) {
r = uv_tcp_keepalive(&handle, 1, 60);
ASSERT_OK(r);
r = uv_tcp_keepalive(&handle, 0, 0);
ASSERT_OK(r);
r = uv_tcp_keepalive(&handle, 1, 0);
ASSERT_OK(r);
uv_close((uv_handle_t*)&handle, NULL);
r = uv_run(loop, UV_RUN_DEFAULT);