]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: Add functions to commit peer changes from the resync task
authorChristopher Faulet <cfaulet@haproxy.com>
Fri, 22 Mar 2024 15:23:40 +0000 (16:23 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 16 Apr 2024 08:29:21 +0000 (10:29 +0200)
For now, nothing is done in these functions. It is only a patch to prepare
the huge part of the refactoring about the locking mechanism of the peers.
These functions will be responsible to check peers state and their learn
status to update the peers section flags accordingly.

src/peers.c

index 8d4377f696f3df443d8ef27d9f9e190356effbda..01e98f4d0f74562467695e63233fc50effc7495b 100644 (file)
@@ -3411,6 +3411,14 @@ static struct appctx *peer_session_create(struct peers *peers, struct peer *peer
        return NULL;
 }
 
+static void __process_peer_learn_status(struct peers *peers, struct peer *peer)
+{
+}
+
+static void __process_peer_state(struct peers *peers, struct peer *peer)
+{
+}
+
 static void __process_running_peer_sync(struct task *task, struct peers *peers, unsigned int state)
 {
        struct peer *ps;
@@ -3447,6 +3455,9 @@ static void __process_running_peer_sync(struct task *task, struct peers *peers,
 
        /* For each session */
        for (ps = peers->remote; ps; ps = ps->next) {
+               __process_peer_learn_status(peers, ps);
+               __process_peer_state(peers, ps);
+
                /* For each remote peers */
                if (!ps->local) {
                        if (!ps->appctx) {
@@ -3585,6 +3596,9 @@ static void __process_stopping_peer_sync(struct task *task, struct peers *peers,
 
        /* For each peer */
        for (ps = peers->remote; ps; ps = ps->next) {
+               __process_peer_learn_status(peers, ps);
+               __process_peer_state(peers, ps);
+
                if ((state & TASK_WOKEN_SIGNAL) && !(peers->flags & PEERS_F_DONOTSTOP)) {
                        /* we're killing a connection, we must apply a random delay before
                         * retrying otherwise the other end will do the same and we can loop