]> git.saurik.com Git - redis.git/commitdiff
Don't reset the client when processCommand returns REDIS_ERR
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 15 Oct 2010 15:27:05 +0000 (17:27 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Fri, 15 Oct 2010 15:27:05 +0000 (17:27 +0200)
src/networking.c
src/redis.c

index cc4c9341d6b2ad6d4bb2323e1a8c6a59ffe7ec7e..e2e25207b5d025b49063ad58450478d38121d1b1 100644 (file)
@@ -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);
+        }
     }
 }
 
index 2d61733a40cb81d67c86c924ce98acf48c9cda56..f4e244f03c01b3a9bebf143efe1c9b8b1a60a1a9 100644 (file)
@@ -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;