summaryrefslogtreecommitdiff
path: root/src/networking.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-02-20 17:07:52 +0100
committerantirez <antirez@gmail.com>2013-02-20 17:07:52 +0100
commit9ec1b709f51b05df6e4ca1637bd5143d585418ab (patch)
tree0a89f8ab9d38a1a37db7dd41d6e01968d5f1e743 /src/networking.c
parentb8d8b9ec4130fcb275d3b63b733f1bb8050a579d (diff)
downloadredis-9ec1b709f51b05df6e4ca1637bd5143d585418ab.tar.gz
Cluster: ASKING command fixed, state was not retained.
Diffstat (limited to 'src/networking.c')
-rw-r--r--src/networking.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/networking.c b/src/networking.c
index b90936011..2c4050723 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -816,12 +816,16 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
/* resetClient prepare the client to process the next command */
void resetClient(redisClient *c) {
+ redisCommandProc *prevcmd = c->cmd ? c->cmd->proc : NULL;
+
freeClientArgv(c);
c->reqtype = 0;
c->multibulklen = 0;
c->bulklen = -1;
- /* We clear the ASKING flag as well if we are not inside a MULTI. */
- if (!(c->flags & REDIS_MULTI)) c->flags &= (~REDIS_ASKING);
+ /* We clear the ASKING flag as well if we are not inside a MULTI, and
+ * if what we just executed is not the ASKING command itself. */
+ if (!(c->flags & REDIS_MULTI) && prevcmd != askingCommand)
+ c->flags &= (~REDIS_ASKING);
}
int processInlineBuffer(redisClient *c) {