mirror of
https://github.com/calzoneman/sync.git
synced 2024-09-13 04:32:09 +00:00
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…
x
Reference in New Issue
Block a user