Skip to content

Commit

Permalink
Surround noop packet polling with try-catch. Since node.js version 0.…
Browse files Browse the repository at this point in the history
…8.20 (http: Raise hangup error on destroyed socket write (isaacs)) a hangup

error is raised when trying to write on destroyed sockets.

fixes socketio#1160
  • Loading branch information
ereslibre committed Feb 18, 2013
1 parent 3cbe0f3 commit 68c9ed8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/transports/http-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ HTTPPolling.prototype.handleRequest = function (req) {
var self = this;

this.pollTimeout = setTimeout(function () {
self.packet({ type: 'noop' });
self.log.debug(self.name + ' closed due to exceeded duration');
try {
self.packet({ type: 'noop' });
self.log.debug(self.name + ' closed due to exceeded duration');
} catch(e) {
self.log.debug('socket destroyed');
}
}, this.manager.get('polling duration') * 1000);

this.log.debug('setting poll timeout');
Expand Down

0 comments on commit 68c9ed8

Please sign in to comment.