Skip to content

Commit 4008273

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 490fbce commit 4008273

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
@@ -331,9 +331,9 @@ Server.prototype.listen = function() {
331331
}
332332
});
333333
sockServer.on("connection", function(conn) {
334+
if(!conn) return;
334335
this.sockets.push(conn);
335336

336-
// Remove the connection when it's closed
337337
conn.on("close", function() {
338338
var connIndex = this.sockets.indexOf(conn);
339339
if(connIndex >= 0) {

0 commit comments

Comments
 (0)