]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: peers: Use true states for the peer applets as seen from outside
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 24 Apr 2024 15:57:29 +0000 (17:57 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Apr 2024 16:29:57 +0000 (18:29 +0200)
commitea9bd6d075069cc2caa89b45ee6a46425a911b4e
tree002ad4375aad924984c96ebc687506ca7854422e
parent229755d8f517f6748e7facdaaf9d2e71ade4f38e
MEDIUM: peers: Use true states for the peer applets as seen from outside

This patch is a cleanup of the recent change about the relation between a
peer and the applet used to deal with I/O. Three flags was introduced to
reflect the peer applet state as seen from outside (from the sync task in
fact). Using flags instead of true states was in fact a bad idea. This work
but it is confusing. Especially because it was mixed with LEARN and TEACH
peer flags.

So, now, to make it clearer, we are now using a dedicated state for this
purpose. From the outside, the peer may be in one of the following state
with respects of its applet:

 * the peer has no applet, it is stopped (PEER_APP_ST_STOPPED).

 * the peer applet was created with a validated connection from the protocol
   perspective. But the sync task must synchronized it with the peers
   section. It is in starting state (PEER_APP_ST_STARTING).

 * The starting starting was acknowledged by the sync task, the peer applet
   can start to process messages. It is in running state
   (PEER_APP_ST_RUNNING).

 * The last peer applet was released and the associated connection
   closed. But the sync task must synchronized it with the peers section. It
   is in stopping state (PEER_APP_ST_STOPPING).

Functionnaly speaking, there is no true change here. But it should be easier
to understand now.

In addition to these changes, __process_peer_state() function was renamed
sync_peer_app_state().
include/haproxy/peers-t.h
src/peers.c