Skip to content

Commit b9074fa

Browse files
jowaydarrachequesne
authored andcommitted
[fix] fix memory leak when leave a room after socket close (#58)
1 parent f7ab50c commit b9074fa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ Adapter.prototype.addAll = function(id, rooms, fn){
7474
*/
7575

7676
Adapter.prototype.del = function(id, room, fn){
77-
this.sids[id] = this.sids[id] || {};
78-
delete this.sids[id][room];
77+
if (this.sids[id]) delete this.sids[id][room];
78+
7979
if (this.rooms.hasOwnProperty(room)) {
8080
this.rooms[room].del(id);
8181
if (this.rooms[room].length === 0) delete this.rooms[room];

0 commit comments

Comments
 (0)