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){
var ctx = new self.Context(self, req, res);
ctx.socket.on('error', onerror);
if (!~ctx.socket.listeners('error').indexOf(onerror)) {
ctx.socket.on('error', onerror);
}
function done(err) {
if (err) ctx.onerror(err);