When short write happens, we should wait for connection to be ready
for write in epoll_wait rather than doing busy loop in the main
thread.

Signed-off-by: MORITA Kazutaka <[email protected]>
---
 sheep/request.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sheep/request.c b/sheep/request.c
index 1f9e335..01a9908 100644
--- a/sheep/request.c
+++ b/sheep/request.c
@@ -709,17 +709,17 @@ static inline int finish_tx(struct client_info *ci)
 
 static void do_client_tx(struct client_info *ci)
 {
-       if (list_empty(&ci->done_reqs)) {
+       if (!ci->tx_req && list_empty(&ci->done_reqs)) {
                if (conn_tx_off(&ci->conn))
                        clear_client_info(ci);
                return;
        }
-again:
+
        if (begin_tx(ci) < 0)
                return;
 
        if (finish_tx(ci))
-               goto again;
+               return;
 
        /* Let's go sleep, and put_request() will wake me up */
        if (conn_tx_off(&ci->conn))
-- 
1.7.2.5

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to