]> git.saurik.com Git - redis.git/commitdiff
When REDIS_CLOSE_AFTER_REPLY is set, there may never be new replies
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Thu, 28 Oct 2010 15:52:16 +0000 (16:52 +0100)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Thu, 28 Oct 2010 15:52:23 +0000 (16:52 +0100)
src/networking.c
src/redis.c

index 949537155921e3d433cd21871913158e8be9ce5b..10273cc1100e3de57cdb34a2664a36b07ba2dab7 100644 (file)
@@ -55,7 +55,12 @@ redisClient *createClient(int fd) {
     return c;
 }
 
+/* Set the event loop to listen for write events on the client's socket.
+ * Typically gets called every time a reply is built. */
 int _installWriteEvent(redisClient *c) {
+    /* When CLOSE_AFTER_REPLY is set, no more replies may be added! */
+    redisAssert(!(c->flags & REDIS_CLOSE_AFTER_REPLY));
+
     if (c->fd <= 0) return REDIS_ERR;
     if (c->bufpos == 0 && listLength(c->reply) == 0 &&
         (c->replstate == REDIS_REPL_NONE ||
index 5c5198239a19ecaec6207e68210cc40ff5431611..1f8d71a7d8f76810ac60196939edbd57312644aa 100644 (file)
@@ -893,7 +893,6 @@ int processCommand(redisClient *c) {
      * go through checking for replication and QUIT will cause trouble
      * when FORCE_REPLICATION is enabled and would be implemented in
      * a regular command proc. */
-    redisAssert(!(c->flags & REDIS_CLOSE_AFTER_REPLY));
     if (!strcasecmp(c->argv[0]->ptr,"quit")) {
         addReply(c,shared.ok);
         c->flags |= REDIS_CLOSE_AFTER_REPLY;