Avoid loop between pool.destroy and client.end

This commit is contained in:
Sandro Santilli 2014-03-18 09:42:19 +01:00
parent 9c5cd8d02d
commit fb118cf069

View File

@ -35,13 +35,18 @@ var pools = {
// Remove connection from pool on disconnect
client.on('end', function(e) {
pool.destroy(client);
// Do not enter infinite loop between pool.destroy
// and client 'end' event...
if ( ! client._destroying ) {
pool.destroy(client);
}
});
return cb(null, client);
});
},
destroy: function(client) {
client._destroying = true;
client.end();
}
});