Skip to content

Commit 3eb2a92

Browse files
jskzSpaceK33z
authored andcommitted
sanity check that conn exists on connection (#637)
This prevents an edge case where null is passed (and aborts the server) on a new connection if all handles are occupied. I am able to reliably trigger this by rapidly refreshing on a page in development.
1 parent 3d55918 commit 3eb2a92

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ Server.prototype.listen = function() {
363363
}
364364
});
365365
sockServer.on("connection", function(conn) {
366+
if(!conn) return;
366367
this.sockets.push(conn);
367368

368-
// Remove the connection when it's closed
369369
conn.on("close", function() {
370370
var connIndex = this.sockets.indexOf(conn);
371371
if(connIndex >= 0) {

0 commit comments

Comments
 (0)