Skip to content
This repository
Browse code

Remove the write handler only if there are no longer objects in the o…

…utput 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.
  • Loading branch information...
commit 61f57b6a8f58e982fc0266e560485c0c9388abf0 1 parent 24a1580
Salvatore Sanfilippo authored September 12, 2011

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  src/networking.c
2  src/networking.c
@@ -611,7 +611,7 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
611 611
         }
612 612
     }
613 613
     if (totwritten > 0) c->lastinteraction = time(NULL);
614  
-    if (listLength(c->reply) == 0) {
  614
+    if (c->bufpos == 0 && listLength(c->reply) == 0) {
615 615
         c->sentlen = 0;
616 616
         aeDeleteFileEvent(server.el,c->fd,AE_WRITABLE);
617 617
 

0 notes on commit 61f57b6

Please sign in to comment.
Something went wrong with that request. Please try again.