Index: daemon.c =================================================================== --- daemon.c (revision 37013) +++ daemon.c (working copy) @@ -2914,6 +2914,8 @@ /* process events for connections */ while (NULL != (pos = daemon->eready_tail)) { + int had_response_before_idle; + EDLL_remove (daemon->eready_head, daemon->eready_tail, pos); @@ -2922,7 +2924,14 @@ pos->read_handler (pos); if (MHD_EVENT_LOOP_INFO_WRITE == pos->event_loop_info) pos->write_handler (pos); + had_response_before_idle = (NULL != pos->response); pos->idle_handler (pos); + /* If we're in TURBO mode, and got a response object, + try opportunistically to just call write immediately. */ + if ( (0 == (daemon->options & MHD_USE_EPOLL_TURBO)) && + (NULL != pos->response) && + (MHD_NO == had_response_before_idle) ) + pos->write_handler (pos); } /* Finally, handle timed-out connections; we need to do this here