Skip to content

Commit 6f22fde

Browse files
committed
http: check if socket is null before destroy
1 parent ed7631d commit 6f22fde

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/_http_server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,15 +487,15 @@ Server.prototype.closeAllConnections = function() {
487487
const connections = this[kConnections].all();
488488

489489
for (let i = 0, l = connections.length; i < l; i++) {
490-
connections[i].socket.destroy();
490+
connections[i].socket?.destroy();
491491
}
492492
};
493493

494494
Server.prototype.closeIdleConnections = function() {
495495
const connections = this[kConnections].idle();
496496

497497
for (let i = 0, l = connections.length; i < l; i++) {
498-
connections[i].socket.destroy();
498+
connections[i].socket?.destroy();
499499
}
500500
};
501501

0 commit comments

Comments
 (0)