Skip to content

Commit

Permalink
Fixes the case where if the quit() method is called, the closing vari…
Browse files Browse the repository at this point in the history
…able checks are not honoured.
  • Loading branch information
Mark Dawson committed Jul 19, 2011
1 parent 3cc297a commit 263965a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function RedisClient(stream, options) {
});

this.stream.on("error", function (msg) {
if (this.closing) {
if (self.closing) {
return;
}

Expand Down Expand Up @@ -503,6 +503,11 @@ RedisClient.prototype.send_command = function (command, args, callback) {
throw new Error("send_command: second argument must be an array");
}

if (command === "quit") {
this.closing = true;
return;
}

command_obj = new Command(command, args, false, callback);

if ((!this.ready && !this.send_anyway) || !stream.writable) {
Expand All @@ -526,8 +531,6 @@ RedisClient.prototype.send_command = function (command, args, callback) {
this.subscriptions = true;
} else if (command === "monitor") {
this.monitoring = true;
} else if (command === "quit") {
this.closing = true;
} else if (this.subscriptions === true) {
throw new Error("Connection in pub/sub mode, only pub/sub commands may be used");
}
Expand Down

0 comments on commit 263965a

Please sign in to comment.