Skip to content

Commit fb2e373

Browse files
committed
http: don't set keepAliveTimeoutBuffer twice.
It's already set once through storeHTTPOptions
1 parent 961554c commit fb2e373

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/_http_server.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -556,12 +556,6 @@ function Server(options, requestListener) {
556556

557557
storeHTTPOptions.call(this, options);
558558

559-
// Optional buffer added to the keep-alive timeout when setting socket timeouts.
560-
// Helps reduce ECONNRESET errors from clients by extending the internal timeout.
561-
// Default is 1000ms if not specified.
562-
const buf = options.keepAliveTimeoutBuffer;
563-
this.keepAliveTimeoutBuffer =
564-
(typeof buf === 'number' && NumberIsFinite(buf) && buf >= 0) ? buf : 1000;
565559
net.Server.call(
566560
this,
567561
{ allowHalfOpen: true, noDelay: options.noDelay ?? true,
@@ -1031,6 +1025,9 @@ function resOnFinish(req, res, socket, state, server) {
10311025
// Extend the internal timeout by the configured buffer to reduce
10321026
// the likelihood of ECONNRESET errors.
10331027
// This allows fine-tuning beyond the advertised keepAliveTimeout.
1028+
validateInteger(server.keepAliveTimeoutBuffer, 'keepAliveTimeoutBuffer', 0);
1029+
validateInteger(server.keepAliveTimeout, 'keepAliveTimeout', 0);
1030+
10341031
socket.setTimeout(server.keepAliveTimeout + server.keepAliveTimeoutBuffer);
10351032
state.keepAliveTimeoutSet = true;
10361033
}

0 commit comments

Comments
 (0)