]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stream-int: always call si_chk_rcv() when we make room in the buffer
authorWilly Tarreau <w@1wt.eu>
Wed, 7 Nov 2018 17:53:29 +0000 (18:53 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 11 Nov 2018 09:18:37 +0000 (10:18 +0100)
commitabf531caa0a2ebdc41f3f9827b265b3b55b6b185
tree3ad537f1b49739f38cfb26521d4198b0a2a7ba20
parent1f9de21c38433ce24d5d5e70c594e72933d36aa4
MEDIUM: stream-int: always call si_chk_rcv() when we make room in the buffer

Instead of clearing the SI_FL_WAIT_ROOM flag and losing the information
about the need from the producer to be woken up, we now call si_chk_rcv()
immediately. This is cheap to do and it could possibly be further improved
by only doing it when SI_FL_WAIT_ROOM was still set, though this will
require some extra auditing of the code paths.

The only remaining place where the flag was cleared without a call to
si_chk_rcv() is si_alloc_ibuf(), but since this one is called from a
receive path woken up from si_chk_rcv() or not having failed, the
clearing was not necessary anymore either.

And there was one place in stream_int_notify() where si_chk_rcv() was
called with SI_FL_WAIT_ROOM still explicitly set so this place was
adjusted in order to clear the flag prior to calling si_chk_rcv().

Now we don't have any situation where we randomly clear SI_FL_WAIT_ROOM
without trying to wake the other side up, nor where we call si_chk_rcv()
with the flag set, so this flag should accurately represent a failed
attempt at putting data into the buffer.
include/proto/stream_interface.h
src/stream_interface.c