Skip to content

Commit

Permalink
Fixes leaking Redis subscriptions for socketio#663. The local flag wa…
Browse files Browse the repository at this point in the history
…s not getting passed through onClientDisconnect().
  • Loading branch information
dshaw committed Nov 26, 2011
1 parent eeaca6d commit d5ab46d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,13 @@ Manager.prototype.onClientMessage = function (id, packet) {
* @api private
*/

Manager.prototype.onClientDisconnect = function (id, reason) {
Manager.prototype.onClientDisconnect = function (id, reason, local) {
for (var name in this.namespaces) {
this.namespaces[name].handleDisconnect(id, reason, typeof this.roomClients[id] !== 'undefined' &&
typeof this.roomClients[id][name] !== 'undefined');
}

this.onDisconnect(id);
this.onDisconnect(id, local);
};

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,15 @@ Transport.prototype.end = function (reason) {
if (!this.disconnected) {
this.log.info('transport end');

var local = this.manager.transports[this.id];
var local = !!this.manager.transports[this.id];

this.close();
this.clearTimeouts();
this.disconnected = true;


if (local) {
this.manager.onClientDisconnect(this.id, reason, true);
this.manager.onClientDisconnect(this.id, reason, local);
} else {
this.store.publish('disconnect:' + this.id, reason);
}
Expand Down

0 comments on commit d5ab46d

Please sign in to comment.