diff --git a/lib/application.js b/lib/application.js index e59b8a3..8af42bc 100644 --- a/lib/application.js +++ b/lib/application.js @@ -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);