fix socket error handler event listener leak

This commit is contained in:
TJ Holowaychuk 2013-08-22 11:52:22 -07:00
parent fe89dc3783
commit 4e4fcfc642

View file

@ -125,7 +125,9 @@ app.callback = function(){
return function(req, res){ return function(req, res){
var ctx = new self.Context(self, req, res); var ctx = new self.Context(self, req, res);
if (!~ctx.socket.listeners('error').indexOf(onerror)) {
ctx.socket.on('error', onerror); ctx.socket.on('error', onerror);
}
function done(err) { function done(err) {
if (err) ctx.onerror(err); if (err) ctx.onerror(err);