Skip to content

Commit

Permalink
http: remove closeIdleConnections function while calling server close
Browse files Browse the repository at this point in the history
Correcting the #50194 backporting mistake.
closeIdleConnections shouldnot be called while server.close in node v18.
This behavior is for node v19 and above.

Fixes: #52330
Fixes: #51677
PR-URL: #52336
Refs: #50194
Reviewed-By: Nitzan Uziely <linkgoron@gmail.com>
  • Loading branch information
kumarrishav authored and richardlau committed Apr 17, 2024
1 parent 678641f commit 6689a98
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/_http_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ function setupConnectionsTracking() {
}

function httpServerPreClose(server) {
server.closeIdleConnections();
clearInterval(server[kConnectionsCheckingInterval]);
}

Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-http-server-close-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ server.listen(0, function() {
assert(response.startsWith('HTTP/1.1 200 OK\r\nConnection: keep-alive'));
assert.strictEqual(connections, 2);

server.closeIdleConnections();
server.close(common.mustCall());

// Check that only the idle connection got closed
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-https-server-close-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ server.listen(0, function() {
assert(response.startsWith('HTTP/1.1 200 OK\r\nConnection: keep-alive'));
assert.strictEqual(connections, 2);

server.closeIdleConnections();
server.close(common.mustCall());

// Check that only the idle connection got closed
Expand Down

0 comments on commit 6689a98

Please sign in to comment.