summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2011-09-12 11:05:48 +0200
committerantirez <antirez@gmail.com>2011-09-12 11:06:11 +0200
commit3c51d3b36b7a4295871f0033ae5a0e2e1aa339f3 (patch)
treec7e53d0459190449e67ba0a54ec902072d4804f6
parent00c7f312cc696ac8b93c155eaa54be117a4da02e (diff)
downloadredis-3c51d3b36b7a4295871f0033ae5a0e2e1aa339f3.tar.gz
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.
-rw-r--r--src/networking.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/networking.c b/src/networking.c
index 5df8f57ba..bc33a4dea 100644
--- a/src/networking.c
+++ b/src/networking.c
@@ -616,7 +616,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);