Skip to content

Commit

Permalink
Merge pull request socketio#667 from dshaw/patch/redis-disconnect
Browse files Browse the repository at this point in the history
Patch/redis disconnect
  • Loading branch information
rauchg committed Nov 26, 2011
2 parents eeaca6d + c110036 commit 9a8c1c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/manager.js
Expand Up @@ -468,13 +468,14 @@ 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);
if (local) this.store.publish('disconnect', id);
this.onDisconnect(id, local);
};

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/transport.js
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 9a8c1c4

Please sign in to comment.