]> git.kaiwu.me - haproxy.git/commit
MEDIUM: peer: Improve management of reconnect timer and heartbeat messages
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 14 Oct 2025 12:09:07 +0000 (14:09 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 17 Oct 2025 14:38:53 +0000 (16:38 +0200)
commit2f1a1e0de30998866a77daceca952809d6c65e42
tree3d260eb0f0496b70d34f904cca637d927102e53f
parent922a1d4e3ac208283e8be5a488cb5d8f64a25bf4
MEDIUM: peer: Improve management of reconnect timer and heartbeat messages

heartbeat messages are sent to keep a connection active. However, a
heartbeat messages was sent periodically, even if some other messages were
sent during this period. It is not an issue but it is useless. heartbeat
messages should only be sent if nothing was sent to the peer since a
moment. So, in this patch, the heartbeat timer is rearmed each time a message
is sent.

On the receiver side, the reconnect timer was only rearmed when a heartbeat
message was received instead of rearming it for any messages. Again, it is
not an issue because the inactivity is managed with PEER_F_ALIVE flag. This
flag is removed when the reconnect timer timed out but it is reinserted when
something is received. But an periodic wakeup may be uselessly performed.
So, in this patch, the reconnect timer is rearmed each time a message is
received.
src/peers.c