Fix race condition

This commit is contained in:
calzoneman 2014-03-16 21:22:41 -05:00
parent aac8f3c671
commit 07819f0b14
1 changed files with 8 additions and 0 deletions

View File

@ -467,8 +467,16 @@ Channel.prototype.getIPRank = function (ip, callback) {
Channel.prototype.preJoin = function (user, password) {
var self = this;
self.whenReady(function () {
if (self.dead) {
return;
}
user.whenLoggedIn(function () {
self.getRank(user.name, function (err, rank) {
if (self.dead) {
return;
}
if (err) {
user.rank = user.global_rank;
} else {