From 61f57b6a8f58e982fc0266e560485c0c9388abf0 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 b31c89df9..9f35987be 100644 --- a/src/networking.c +++ b/src/networking.c @@ -611,7 +611,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); -- GitLab