From 3bc89500d22ea86a15d58f88e159bb92374a61e0 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 12 Sep 2011 11:05:48 +0200 Subject: [PATCH] Remove the write handler only if there are no longer objects in the output queue AND if the static buffer is empty. This bug was the cause of a possible server-stop-responding-to-client bug under some specific work load. Thanks to Pieter Noordhuis for spotting and fixing it. --- src/networking.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/networking.c b/src/networking.c index 7f9b96f7..3979ab62 100644 --- a/src/networking.c +++ b/src/networking.c @@ -610,7 +610,7 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) { } } if (totwritten > 0) c->lastinteraction = time(NULL); - if (listLength(c->reply) == 0) { + if (c->bufpos == 0 && listLength(c->reply) == 0) { c->sentlen = 0; aeDeleteFileEvent(server.el,c->fd,AE_WRITABLE); -- 2.45.2