mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
doc: clarify sub-1000ms behavior in socket.setKeepAlive
The current documentation states that `initialDelay` and `interval` are divided by 1000 and rounded down, but does not explicitly mention that values less than 1000ms will result in 0 seconds. This can lead to confusion when users pass values like 400ms expecting sub-second keepalive delays. Add a concrete example showing that 400ms rounds down to 0 seconds. Refs: https://github.com/nodejs/node/issues/57712 Signed-off-by: haramjeong <04harams77@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65869 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
1 parent
7e1db4724a
commit
317abb8131
1 file changed
+3
-1
+3
-1
@@ -1632,7 +1632,9 @@ corresponding system default unchanged.
|
||||
|
||||
`initialDelay` and `interval` are specified in milliseconds but the
|
||||
underlying socket options are configured in whole seconds; the values are
|
||||
divided by `1000` and rounded down before being applied.
|
||||
divided by `1000` and rounded down before being applied. For example,
|
||||
setting `initialDelay` to `400` will result in a `TCP_KEEPIDLE` of `0`
|
||||
seconds (since `400 / 1000` rounds down to `0`).
|
||||
|
||||
Enabling the keep-alive functionality will set the following socket options:
|
||||
|
||||
|
||||
Reference in new issue
Block a user