mirror of https://github.com/calzoneman/sync.git
Fix activeLock bug
This commit is contained in:
parent
f92d4bc5d4
commit
1c77a24839
|
@ -282,9 +282,11 @@ Channel.prototype.notifyModules = function (fn, args) {
|
|||
Channel.prototype.joinUser = function (user, data) {
|
||||
var self = this;
|
||||
|
||||
self.activeLock.lock();
|
||||
self.waitFlag(Flags.C_READY, function () {
|
||||
/* User closed the connection before the channel finished loading */
|
||||
if (user.socket.disconnected) {
|
||||
self.activeLock.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -293,6 +295,7 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
if (err) {
|
||||
Logger.errlog.log("user.refreshAccount failed at Channel.joinUser");
|
||||
Logger.errlog.log(err.stack);
|
||||
self.activeLock.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -304,6 +307,7 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
|
||||
function afterAccount() {
|
||||
if (self.dead || user.socket.disconnected) {
|
||||
if (self.activeLock) self.activeLock.release();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -312,11 +316,11 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
if (user.account.channelRank !== user.account.globalRank) {
|
||||
user.socket.emit("rank", user.account.effectiveRank);
|
||||
}
|
||||
self.activeLock.lock();
|
||||
self.acceptUser(user);
|
||||
} else {
|
||||
user.account.channelRank = 0;
|
||||
user.account.effectiveRank = user.account.globalRank;
|
||||
self.activeLock.release();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue