Address race condition

This commit is contained in:
calzoneman 2014-01-25 17:47:38 -06:00
parent 0329e564a9
commit 1355455548

View file

@ -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);
}
});