BUG/MINOR: stream-int: avoid calling rcv_buf() when splicing is still possible
authorWilly Tarreau <w@1wt.eu>
Tue, 3 Dec 2019 17:13:04 +0000 (18:13 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 5 Dec 2019 06:27:38 +0000 (07:27 +0100)
commitdd2efd48d5c408ebc66e195c867378444acb4f4a
tree1671052b7a0bafc437b27ec99b6cc5db099eec2f
parentc4fcb6b3644b87a46fb8735a387b9bd9bf61ffaf
BUG/MINOR: stream-int: avoid calling rcv_buf() when splicing is still possible

In si_cs_recv(), we can end up with a partial splice() call that will be
followed by an attempt to us rcv_buf(). Sometimes this works and places
data into the buffer, which then prevent splicing from being used, and
this causes splice() and recvfrom() calls to alternate. Better simply
refrain from calling rcv_buf() when there are data in the pipe and still
data to be forwarded. Usually this indicates that we've ate everything
available and that we still want to use splice() on subsequent calls.

This should be backported to 2.1 and 2.0.

(cherry picked from commit c640ef1a7de5d13504599f85ca3cf3c282128a05)
Signed-off-by: Willy Tarreau <w@1wt.eu>
src/stream_interface.c