From 9da6caac4e86aa608a3186fa8a209eed19b7b9c6 Mon Sep 17 00:00:00 2001 From: Pieter Noordhuis Date: Fri, 15 Oct 2010 17:27:05 +0200 Subject: [PATCH] Don't reset the client when processCommand returns REDIS_ERR --- src/networking.c | 10 +++++++--- src/redis.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/networking.c b/src/networking.c index cc4c9341..e2e25207 100644 --- a/src/networking.c +++ b/src/networking.c @@ -820,9 +820,13 @@ void processInputBuffer(redisClient *c) { } /* Multibulk processing could see a <= 0 length. */ - if (c->argc > 0) - processCommand(c); - resetClient(c); + if (c->argc == 0) { + resetClient(c); + } else { + /* Only reset the client when the command was executed. */ + if (processCommand(c) == REDIS_OK) + resetClient(c); + } } } diff --git a/src/redis.c b/src/redis.c index 2d61733a..f4e244f0 100644 --- a/src/redis.c +++ b/src/redis.c @@ -955,7 +955,7 @@ int processCommand(redisClient *c) { addReply(c,shared.queued); } else { if (server.vm_enabled && server.vm_max_threads > 0 && - blockClientOnSwappedKeys(c,cmd)) return 1; + blockClientOnSwappedKeys(c,cmd)) return REDIS_ERR; call(c,cmd); } return REDIS_OK;