]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: stream: rearrange the events to remove the loop
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 07:17:23 +0000 (09:17 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Jun 2019 14:36:19 +0000 (16:36 +0200)
commit829bd4710f69ac1d4cce76ac35c56e004ffef26d
tree60bc5302df279c94e3594c7232e8f43c0cf47f09
parent3b285d7fbd12402fbab15effb84e15c85bf2e18f
MEDIUM: stream: rearrange the events to remove the loop

The "goto redo" at the end of process_stream() to make the states converge
is still a big source of problems and mostly stems from the very late call
to the send() functions, whose results need to be considered, while it's
being done in si_update_both() when leaving.

This patch extracts the si_sync_send() calls from si_update_both(), and
places them at the relevant places in process_stream(), which are just
after the amount of data to forward is updated and before the shutw()
calls (which were also moved). The stream-interface resynchronization
needs to go slightly upper to take into account the transition from CON
to RDY that will happen consecutive to some successful send(), and that's
all.

By doing so we can now get rid of this loop and have si_update_both()
called only to update the stream interface and channel when leaving the
function, as it was initially designed to work.

It is worth noting that a number of the remaining conditions to perform
a goto resync_XXX still seem suboptimal and would benefit from being
refined to perform les resynchronization. But what matters at this stage
is that the code remains valid and efficient.
src/stream.c
src/stream_interface.c