From 9ec1b709f51b05df6e4ca1637bd5143d585418ab Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 20 Feb 2013 17:07:52 +0100 Subject: [PATCH] Cluster: ASKING command fixed, state was not retained. --- src/networking.c | 8 ++++++-- 1 file 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) {