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.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 (self.opts.password !== false && user.rank < 2) {
|
||||||
if (password !== self.opts.password) {
|
if (password !== self.opts.password) {
|
||||||
user.socket.emit("needPassword", typeof password !== "undefined");
|
user.socket.emit("needPassword", typeof password !== "undefined");
|
||||||
user.whenLoggedIn(function () {
|
user.once("channelRank", function (r) {
|
||||||
if (user.rank >= 2) {
|
if (r >= 2) {
|
||||||
self.join(user);
|
self.join(user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue