From 95a4f96cedf2bdd613bc6167963c2ffb04deaf0d Mon Sep 17 00:00:00 2001 From: Arnold Zokas Date: Tue, 20 Apr 2021 15:28:34 +0100 Subject: [PATCH 1/2] doc: document new TCP_KEEPCNT and TCP_KEEPINTVL socket option defaults PR https://github.com/nodejs/node/pull/32204 introduced new defaults for the TCP keep-alive socket options (see deps/uv/src/unix/tcp.c): - "TCP_KEEPCNT" now defaults to 10 on all platforms - "TCP_KEEPINTVL" now defaults to 1 on all platforms Previously, "TCP_KEEPCNT" and "TCP_KEEPINTVL" were not set explicitly and OS-default values were used. Fixes: https://github.com/nodejs/node/issues/38298 Refs: https://github.com/nodejs/node/pull/32204 --- doc/api/net.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/api/net.md b/doc/api/net.md index 699b1ba4d573b8..b5eb5aba39fa8f 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1006,6 +1006,10 @@ Set the encoding for the socket as a [Readable Stream][]. See ### `socket.setKeepAlive([enable][, initialDelay])` * `enable` {boolean} **Default:** `false` @@ -1020,6 +1024,12 @@ data packet received and the first keepalive probe. Setting `0` for `initialDelay` will leave the value unchanged from the default (or previous) setting. +Enabling the keep-alive functionality will set the following socket options: +* `SO_KEEPALIVE=1` +* `TCP_KEEPIDLE=initialDelay` +* `TCP_KEEPCNT=10` +* `TCP_KEEPINTVL=1` + ### `socket.setNoDelay([noDelay])`