Skip to content

Commit fb118cf

Browse files
author
Sandro Santilli
committed
Avoid loop between pool.destroy and client.end
1 parent 9c5cd8d commit fb118cf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/pool.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,18 @@ var pools = {
3535

3636
// Remove connection from pool on disconnect
3737
client.on('end', function(e) {
38-
pool.destroy(client);
38+
// Do not enter infinite loop between pool.destroy
39+
// and client 'end' event...
40+
if ( ! client._destroying ) {
41+
pool.destroy(client);
42+
}
3943
});
4044

4145
return cb(null, client);
4246
});
4347
},
4448
destroy: function(client) {
49+
client._destroying = true;
4550
client.end();
4651
}
4752
});

0 commit comments

Comments
 (0)