mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-10 19:21:37 +00:00
BUG/MINOR: stream_interface: don't loop over ->snd_buf()
It is stupid to loop over ->snd_buf() because the snd_buf() itself already loops and stops when system buffers are full. But looping again onto it, we lose the information of the full buffers and perform one useless syscall. Furthermore, this causes issues when dealing with large uploads while waiting for a connection to establish, as it can report a server reject of some data as a connection abort, which is wrong. 1.4 does not have this issue as it loops maximum twice (once for each buffer half) and exists as soon as system buffers are full. So no backport is needed.
This commit is contained in:
parent
cbb9a4b128
commit
ed7f836f07
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user