Skip to content

Commit

Permalink
[fix] fix memory leak when leave a room after socket close (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
joway authored and darrachequesne committed Nov 25, 2019
1 parent f7ab50c commit b9074fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ Adapter.prototype.addAll = function(id, rooms, fn){
*/

Adapter.prototype.del = function(id, room, fn){
this.sids[id] = this.sids[id] || {};
delete this.sids[id][room];
if (this.sids[id]) delete this.sids[id][room];

if (this.rooms.hasOwnProperty(room)) {
this.rooms[room].del(id);
if (this.rooms[room].length === 0) delete this.rooms[room];
Expand Down

0 comments on commit b9074fa

Please sign in to comment.