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
This commit is contained in:
parent
6912038d72
commit
14403a8f63
@ -467,9 +467,6 @@ int uv__tcp_keepalive(int fd, int on, unsigned int delay) {
|
|||||||
if (!on)
|
if (!on)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (delay == 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
#ifdef __sun
|
#ifdef __sun
|
||||||
/* The implementation of TCP keep-alive on Solaris/SmartOS is a bit unusual
|
/* The implementation of TCP keep-alive on Solaris/SmartOS is a bit unusual
|
||||||
* compared to other Unix-like systems.
|
* compared to other Unix-like systems.
|
||||||
|
|||||||
@ -33,7 +33,7 @@ TEST_IMPL(tcp_flags) {
|
|||||||
|
|
||||||
loop = uv_default_loop();
|
loop = uv_default_loop();
|
||||||
|
|
||||||
r = uv_tcp_init(loop, &handle);
|
r = uv_tcp_init_ex(loop, &handle, AF_INET);
|
||||||
ASSERT_OK(r);
|
ASSERT_OK(r);
|
||||||
|
|
||||||
r = uv_tcp_nodelay(&handle, 1);
|
r = uv_tcp_nodelay(&handle, 1);
|
||||||
@ -42,6 +42,12 @@ TEST_IMPL(tcp_flags) {
|
|||||||
r = uv_tcp_keepalive(&handle, 1, 60);
|
r = uv_tcp_keepalive(&handle, 1, 60);
|
||||||
ASSERT_OK(r);
|
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);
|
uv_close((uv_handle_t*)&handle, NULL);
|
||||||
|
|
||||||
r = uv_run(loop, UV_RUN_DEFAULT);
|
r = uv_run(loop, UV_RUN_DEFAULT);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user