We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8671a6c commit 2865d2aCopy full SHA for 2865d2a
1 file changed
lib/_http_server.js
@@ -1025,11 +1025,16 @@ function resOnFinish(req, res, socket, state, server) {
1025
socket.end();
1026
}
1027
} else if (state.outgoing.length === 0) {
1028
- if (server.keepAliveTimeout && typeof socket.setTimeout === 'function') {
+ const keepAliveTimeout = NumberIsFinite(server.keepAliveTimeout) && server.keepAliveTimeout >= 0 ?
1029
+ server.keepAliveTimeout : 0;
1030
+ const keepAliveTimeoutBuffer = NumberIsFinite(server.keepAliveTimeoutBuffer) && server.keepAliveTimeoutBuffer >= 0 ?
1031
+ server.keepAliveTimeoutBuffer : 1e3;
1032
+
1033
+ if (keepAliveTimeout && typeof socket.setTimeout === 'function') {
1034
// Extend the internal timeout by the configured buffer to reduce
1035
// the likelihood of ECONNRESET errors.
1036
// This allows fine-tuning beyond the advertised keepAliveTimeout.
- socket.setTimeout(server.keepAliveTimeout + server.keepAliveTimeoutBuffer);
1037
+ socket.setTimeout(keepAliveTimeout + keepAliveTimeoutBuffer);
1038
state.keepAliveTimeoutSet = true;
1039
1040
} else {
0 commit comments