diff --git a/include/common/defaults.h b/include/common/defaults.h index 3a67d3353..ae49263a1 100644 --- a/include/common/defaults.h +++ b/include/common/defaults.h @@ -83,13 +83,6 @@ #define MIN_RECV_AT_ONCE_ENOUGH (7*1448) #endif -// same, but for writes. Generally, it's enough to write twice: one time for -// first half of the buffer, and a second time for the last half after a -// wrap-around. -#ifndef MAX_WRITE_POLL_LOOPS -#define MAX_WRITE_POLL_LOOPS 2 -#endif - // The minimum number of bytes to be forwarded that is worth trying to splice. // Below 4kB, it's not worth allocating pipes nor pretending to zero-copy. #ifndef MIN_SPLICE_FORWARD diff --git a/src/stream_interface.c b/src/stream_interface.c index cb3e7ea54..deb14b4cf 100644 --- a/src/stream_interface.c +++ b/src/stream_interface.c @@ -671,7 +671,6 @@ static int si_conn_send_loop(struct connection *conn) { struct stream_interface *si = conn->owner; struct channel *chn = si->ob; - int write_poll = MAX_WRITE_POLL_LOOPS; int ret; if (chn->pipe && conn->xprt->snd_pipe) { @@ -728,8 +727,10 @@ static int si_conn_send_loop(struct connection *conn) break; } - if (--write_poll <= 0) - break; + /* if some data remain in the buffer, it's only because the + * system bufers are full, so we don't want to loop again. + */ + break; } /* while */ if (conn->flags & CO_FL_ERROR)