You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix auth emitting the error even though a callback is present
Fix auth manipulating the returned error And this is also removing some dead code
This commit is contained in:
12
index.js
12
index.js
@@ -206,20 +206,20 @@ RedisClient.prototype.do_auth = function () {
|
||||
debug("Warning: Redis server does not require a password, but a password was supplied.");
|
||||
err = null;
|
||||
res = "OK";
|
||||
} else if (self.auth_callback) {
|
||||
self.auth_callback(err);
|
||||
self.auth_callback = null;
|
||||
} else {
|
||||
return self.emit("error", new Error("Auth error: " + err.message));
|
||||
self.emit("error", err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
res = res.toString();
|
||||
if (res !== "OK") {
|
||||
return self.emit("error", new Error("Auth failed: " + res));
|
||||
}
|
||||
|
||||
debug("Auth succeeded " + self.address + " id " + self.connection_id);
|
||||
|
||||
if (self.auth_callback) {
|
||||
self.auth_callback(err, res);
|
||||
self.auth_callback(null, res);
|
||||
self.auth_callback = null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user