From 565e49007830a0dd9c4bd6171b3a03c37b3f366a Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Sun, 13 Jul 2014 12:23:04 -0700 Subject: [PATCH] Fix setFlag/waitFlag edge case that was causing duplicate joins --- lib/channel/channel.js | 8 ++------ lib/user.js | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/channel/channel.js b/lib/channel/channel.js index 2ea5f70f..d3c3e812 100644 --- a/lib/channel/channel.js +++ b/lib/channel/channel.js @@ -26,14 +26,10 @@ function ActiveLock(channel) { ActiveLock.prototype = { lock: function () { this.count++; - //console.log('dbg: lock/count: ', this.count); - //console.trace(); }, release: function () { this.count--; - //console.log('dbg: release/count: ', this.count); - //console.trace(); if (this.count === 0) { /* sanity check */ if (this.channel.users.length > 0) { @@ -87,8 +83,8 @@ Channel.prototype.waitFlag = function (flag, cb) { if (self.is(flag)) { cb(); } else { - var wait = function () { - if (self.is(flag)) { + var wait = function (f) { + if (f === flag) { self.unbind("setFlag", wait); cb(); } diff --git a/lib/user.js b/lib/user.js index 72948282..fe84790b 100644 --- a/lib/user.js +++ b/lib/user.js @@ -140,7 +140,7 @@ User.prototype.waitFlag = function (flag, cb) { cb(); } else { var wait = function (f) { - if ((f & flag) === flag) { + if (f === flag) { self.unbind("setFlag", wait); cb(); }