mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Merge pull request #10 from rase-/patch-1
Add autoprunning of empty rooms - rebased
This commit is contained in:
8
index.js
8
index.js
@@ -63,6 +63,10 @@ Adapter.prototype.del = function(id, room, fn){
|
||||
this.rooms[room] = this.rooms[room] || {};
|
||||
delete this.sids[id][room];
|
||||
delete this.rooms[room][id];
|
||||
if (!this.rooms[room].length) {
|
||||
delete this.rooms[room];
|
||||
}
|
||||
|
||||
if (fn) process.nextTick(fn.bind(null, null));
|
||||
};
|
||||
|
||||
@@ -80,6 +84,10 @@ Adapter.prototype.delAll = function(id, fn){
|
||||
if (rooms.hasOwnProperty(room)) {
|
||||
delete this.rooms[room][id];
|
||||
}
|
||||
|
||||
if (!this.rooms[room].length) {
|
||||
delete this.rooms[room];
|
||||
}
|
||||
}
|
||||
}
|
||||
delete this.sids[id];
|
||||
|
||||
Reference in New Issue
Block a user