Fix login race condition (#583)
This commit is contained in:
parent
8ede986d22
commit
e9fdb1a7e5
|
@ -2,7 +2,7 @@
|
|||
"author": "Calvin Montgomery",
|
||||
"name": "CyTube",
|
||||
"description": "Online media synchronizer and chat",
|
||||
"version": "3.17.2",
|
||||
"version": "3.17.3",
|
||||
"repository": {
|
||||
"url": "http://github.com/calzoneman/sync"
|
||||
},
|
||||
|
|
|
@ -323,15 +323,20 @@ Channel.prototype.joinUser = function (user, data) {
|
|||
}
|
||||
|
||||
if (self.is(Flags.C_REGISTERED)) {
|
||||
user.refreshAccount({ channel: self.name }, function (err, account) {
|
||||
if (err) {
|
||||
Logger.errlog.log("user.refreshAccount failed at Channel.joinUser");
|
||||
Logger.errlog.log(err.stack);
|
||||
self.refCounter.unref("Channel::user");
|
||||
return;
|
||||
}
|
||||
user.waitFlag(Flags.U_LOGGED_IN, () => {
|
||||
user.refreshAccount({
|
||||
channel: self.name,
|
||||
name: user.getName()
|
||||
}, function (err, account) {
|
||||
if (err) {
|
||||
Logger.errlog.log("user.refreshAccount failed at Channel.joinUser");
|
||||
Logger.errlog.log(err.stack);
|
||||
self.refCounter.unref("Channel::user");
|
||||
return;
|
||||
}
|
||||
|
||||
afterAccount();
|
||||
afterAccount();
|
||||
});
|
||||
});
|
||||
} else {
|
||||
afterAccount();
|
||||
|
|
Loading…
Reference in a new issue