Skip to content

Commit

Permalink
Added more listeners, to prevent uncaught exceptions. See https://gis…
Browse files Browse the repository at this point in the history
…t.github.com/615009 for uncaptured 'timeout' errors.
  • Loading branch information
3rd-Eden committed Mar 3, 2011
1 parent 1ee5285 commit 63624e5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/socket.io/client.js
Expand Up @@ -87,10 +87,17 @@ Client.prototype._onConnect = function(req, res){
req.addListener('error', function(err){
req.destroy && req.destroy();
});
if (res) res.addListener('error', function(err){
res.destroy && res.destroy();
req.addListener('timeout', function(err){
req.destroy && req.destroy();
});

if (res){
res.addListener('error', function(err){
res.destroy && res.destroy();
});
res.addListener('timeout', function(err){
res.destroy && res.destroy();
});
}
if (this._disconnectTimeout) clearTimeout(this._disconnectTimeout);
}
};
Expand Down

0 comments on commit 63624e5

Please sign in to comment.