]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: peers: Rename PEERS_F_TEACH_COMPLETE to PEERS_F_LOCAL_TEACH_COMPLETE
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Apr 2024 06:27:20 +0000 (08:27 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Apr 2024 16:29:57 +0000 (18:29 +0200)
PEERS_F_TEACH_COMPLETE flag is only used for the old local peer to let the
sync task know it can stop waiting during a soft-stop. So it is less
confusing to rename this flag to clearly state it concerns local peer only.

src/peers.c

index 674cbd7f12ad829744b9df16ea9819f008dd1d23..a3250bc688eded2db15799bb6917f6312b310be6 100644 (file)
@@ -92,7 +92,7 @@
 #define PEER_F_TEACH_PROCESS        0x00000001 /* Teach a lesson to current peer */
 /* unused : 0x00000002..0x00000004 */
 #define PEER_F_TEACH_FINISHED       0x00000008 /* Teach conclude, (wait for confirm) */
-#define PEER_F_TEACH_COMPLETE       0x00000010 /* All that we know already taught to current peer, used only for a local peer */
+#define PEER_F_LOCAL_TEACH_COMPLETE 0x00000010 /* All that we know already taught to current peer, used only for a local peer */
 /* unused : 0x00000020..0x00000100 */
 #define PEER_F_LEARN_NOTUP2DATE     0x00000200 /* Learn from peer finished but peer is not up to date */
 /* unused : 0x00000400..0x00008000  */
 #define PEER_F_HEARTBEAT            0x40000000 /* Heartbeat message to send. */
 #define PEER_F_DWNGRD               0x80000000 /* When this flag is enabled, we must downgrade the supported version announced during peer sessions. */
 
-#define PEER_TEACH_RESET            ~(PEER_F_TEACH_PROCESS|PEER_F_TEACH_FINISHED) /* PEER_F_TEACH_COMPLETE should never be reset */
+#define PEER_TEACH_RESET            ~(PEER_F_TEACH_PROCESS|PEER_F_TEACH_FINISHED)
 
 
 #define PEER_RESYNC_TIMEOUT         5000 /* 5 seconds */
@@ -2557,7 +2557,7 @@ static inline int peer_treat_awaited_msg(struct appctx *appctx, struct peer *pee
                        /* If stopping state */
                        if (stopping) {
                                /* Close session, push resync no more needed */
-                               peer->flags |= PEER_F_TEACH_COMPLETE;
+                               peer->flags |= PEER_F_LOCAL_TEACH_COMPLETE;
                                appctx->st0 = PEER_SESS_ST_END;
                                return 0;
                        }
@@ -3655,7 +3655,7 @@ static void __process_stopping_peer_sync(struct task *task, struct peers *peers,
 
        ps = peers->local;
        HA_SPIN_LOCK(PEER_LOCK, &ps->lock);
-       if (ps->flags & PEER_F_TEACH_COMPLETE) {
+       if (ps->flags & PEER_F_LOCAL_TEACH_COMPLETE) {
                if (peers->flags & PEERS_F_DONOTSTOP) {
                        /* resync of new process was complete, current process can die now */
                        _HA_ATOMIC_DEC(&jobs);