From 3c6ed35d38bee585921fe608fcb35cc192246b93 Mon Sep 17 00:00:00 2001 From: Efe Karasakal Date: Mon, 9 Mar 2026 18:23:41 +0100 Subject: [PATCH 1/4] doc: clarify socket.setKeepAlive initialDelay arg Signed-off-by: Efe Karasakal --- doc/api/net.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/net.md b/doc/api/net.md index 9b330a948019ab..81d80404106948 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1404,6 +1404,9 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. +**Note:** Node.js converts `initialDelay` from milliseconds to seconds and truncates any fractional part. +For example, `1500` becomes `1`, and values from `1` to `999` become `0`. + Enabling the keep-alive functionality will set the following socket options: * `SO_KEEPALIVE=1` From 8cd6f9a475fb2053526e75cec0215f23056ee9bb Mon Sep 17 00:00:00 2001 From: Efe Karasakal Date: Sun, 29 Mar 2026 12:59:17 +0200 Subject: [PATCH 2/4] doc: better examples --- doc/api/net.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/net.md b/doc/api/net.md index 81d80404106948..0c829ba371847e 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1404,8 +1404,9 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. -**Note:** Node.js converts `initialDelay` from milliseconds to seconds and truncates any fractional part. -For example, `1500` becomes `1`, and values from `1` to `999` become `0`. +**Note**: Node.js converts initialDelay from milliseconds to seconds and truncates any fractional part. +For example, `setKeepAlive(true, 500)` does not update the delay because it is truncated to `0`, leaving the value +unchanged, while `setKeepAlive(true, 1500)` sets it to `1` second. Enabling the keep-alive functionality will set the following socket options: From 102b2e735fe30eb63abcf3a6b4b58b624d73d19b Mon Sep 17 00:00:00 2001 From: Efe Date: Fri, 5 Jun 2026 21:58:46 +0200 Subject: [PATCH 3/4] doc: apply suggestion Co-authored-by: Ethan Arrowood --- doc/api/net.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/net.md b/doc/api/net.md index 0c829ba371847e..8cf594165bf675 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1406,7 +1406,8 @@ data packet received and the first keepalive probe. Setting `0` for **Note**: Node.js converts initialDelay from milliseconds to seconds and truncates any fractional part. For example, `setKeepAlive(true, 500)` does not update the delay because it is truncated to `0`, leaving the value -unchanged, while `setKeepAlive(true, 1500)` sets it to `1` second. +For example, `setKeepAlive(true, 500)` does not update the delay because it is first converted to `0.5` and then truncated to `0`, leaving the value +unchanged, while `setKeepAlive(true, 1500)` sets it to `1` second (converted to `1.5`, then truncated to `1`). Enabling the keep-alive functionality will set the following socket options: From 1d6fa32221513b5e75c46437e6e65fee37abc82b Mon Sep 17 00:00:00 2001 From: efekrskl <8130264+efekrskl@users.noreply.github.com> Date: Fri, 5 Jun 2026 21:59:40 +0200 Subject: [PATCH 4/4] doc: fix duplicated line --- doc/api/net.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/net.md b/doc/api/net.md index 8cf594165bf675..265cc8c135b6e0 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1405,7 +1405,6 @@ data packet received and the first keepalive probe. Setting `0` for (or previous) setting. **Note**: Node.js converts initialDelay from milliseconds to seconds and truncates any fractional part. -For example, `setKeepAlive(true, 500)` does not update the delay because it is truncated to `0`, leaving the value For example, `setKeepAlive(true, 500)` does not update the delay because it is first converted to `0.5` and then truncated to `0`, leaving the value unchanged, while `setKeepAlive(true, 1500)` sets it to `1` second (converted to `1.5`, then truncated to `1`).