Fix login race condition (#583)

This commit is contained in:
calzoneman 2016-06-26 16:21:15 -07:00
parent 8ede986d22
commit e9fdb1a7e5
2 changed files with 14 additions and 9 deletions

View File

@ -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"
},

View File

@ -323,7 +323,11 @@ Channel.prototype.joinUser = function (user, data) {
}
if (self.is(Flags.C_REGISTERED)) {
user.refreshAccount({ channel: self.name }, function (err, account) {
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);
@ -333,6 +337,7 @@ Channel.prototype.joinUser = function (user, data) {
afterAccount();
});
});
} else {
afterAccount();
}