]> 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>
Tue, 21 Oct 2025 13:11:29 +0000 (15:11 +0200)
commitf12900afd47a869b891fd646f6a2b2379a601b1a
tree96ed39e1dcdf9ab5d95a734e5f773773f26172bd
parent40c46635801d5d7f72d7e7d5e33a2e1097632876
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