change socket error listener to just use length

This commit is contained in:
TJ Holowaychuk 2013-08-22 11:53:14 -07:00
parent 4e4fcfc642
commit 832a1dcc1e

View file

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