aboutsummaryrefslogtreecommitdiff
path: root/test/test-tcp-flags.c
diff options
context:
space:
mode:
authorAndy Pan <i@andypan.me>2025-05-21 14:43:53 +0800
committerGitHub <noreply@github.com>2025-05-21 08:43:53 +0200
commit3a9a6e3e6bc78565ddf94cf462c9877c1004bb62 (patch)
treed684b2e44f5dc44ac608ca681422dc9f33c142a6 /test/test-tcp-flags.c
parent71ec5c0fcdd867b64c46ade1e0a6b59101281a4a (diff)
downloadlibuv-main.tar.gz
libuv-main.zip
tcp: support customizing TCP_KEEPINTVL and TCP_KEEPCNTHEADv1.xmain
Implement `uv_tcp_keepalive_ex` function that extends `uv_tcp_keepalive` to support `TCP_KEEPINTVL` and `TCP_KEEPCN` socket options in addition to TCP_KEEPIDLE.
Diffstat (limited to 'test/test-tcp-flags.c')
-rw-r--r--test/test-tcp-flags.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test-tcp-flags.c b/test/test-tcp-flags.c
index 16218a27..04a238b2 100644
--- a/test/test-tcp-flags.c
+++ b/test/test-tcp-flags.c
@@ -49,6 +49,21 @@ TEST_IMPL(tcp_flags) {
r = uv_tcp_keepalive(&handle, 1, 0);
ASSERT_EQ(r, UV_EINVAL);
+ r = uv_tcp_keepalive_ex(&handle, 1, 60, 60, 60);
+ ASSERT_OK(r);
+
+ r = uv_tcp_keepalive_ex(&handle, 0, 0, 0, 0);
+ ASSERT_OK(r);
+
+ r = uv_tcp_keepalive_ex(&handle, 1, 0, 10, 10);
+ ASSERT_EQ(r, UV_EINVAL);
+
+ r = uv_tcp_keepalive_ex(&handle, 1, 10, 0, 10);
+ ASSERT_EQ(r, UV_EINVAL);
+
+ r = uv_tcp_keepalive_ex(&handle, 1, 10, 10, 0);
+ ASSERT_EQ(r, UV_EINVAL);
+
uv_close((uv_handle_t*)&handle, NULL);
r = uv_run(loop, UV_RUN_DEFAULT);