]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: stream-int: add two flags to indicate an applet's wishes regarding I/O
authorWilly Tarreau <w@1wt.eu>
Tue, 21 Apr 2015 16:44:02 +0000 (18:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 23 Apr 2015 15:56:17 +0000 (17:56 +0200)
commiteb406dc73c83f7fd67bbe5c5effb4f8b250f6d1d
treeae4f6b401d365878771efbc44f5361a2ceb5c1f4
parentbc39a5d8c86c0fe3c2ca7fbf0b90a85810fad23e
MINOR: stream-int: add two flags to indicate an applet's wishes regarding I/O

Currently we have a problem. There are some cases where a sleeping applet
is not woken up (eg: show sess during an injection). The reason is that
the applet is marked WAIT_DATA and is not woken up when WAIT_ROOM leaves,
because we wait for both flags to be cleared in order to call it.

And if we wait for either flag, then we have the opposite situation, which
is that we're not waiting for room in the output buffer so we're spinning
calling the applet to do nothing.

What is missing is an indication of what the applet needs. Since it only
manipulates the WAIT_ROOM/WAIT_DATA which are overwritten later, that cannot
work. In the case of connections, the problem doesn't happen because the
connection maintains these extra states. Ideally we'd need to have similar
states for each appctx and to store those information there. But it would
be overcomplicated given that an applet doesn't exist alone without a
stream-int, so we can safely put these information into the stream int and
make the code simpler.

With this patch we introduce two new flags in the stream interface :
  - SI_FL_WANT_PUT : the applet wants to put something into the buffer
  - SI_FL_WANT_GET : the applet wants to get something from the buffer

We also have the new functions si_applet_{stop|want|cant}_{get|put}
to make the code look similar to the connection code.

For now these flags are not used yet.
include/proto/stream_interface.h
include/types/stream_interface.h