mirror of https://github.com/calzoneman/sync.git
Address race condition
This commit is contained in:
parent
0329e564a9
commit
1355455548
|
@ -455,6 +455,7 @@ Channel.prototype.join = function (user, password) {
|
|||
}
|
||||
|
||||
user.socket.emit("rank", user.rank);
|
||||
user.emit("channelRank", user.rank);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -517,8 +518,8 @@ Channel.prototype.join = function (user, password) {
|
|||
if (self.opts.password !== false && user.rank < 2) {
|
||||
if (password !== self.opts.password) {
|
||||
user.socket.emit("needPassword", typeof password !== "undefined");
|
||||
user.whenLoggedIn(function () {
|
||||
if (user.rank >= 2) {
|
||||
user.once("channelRank", function (r) {
|
||||
if (r >= 2) {
|
||||
self.join(user);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue