]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: peer: Improve management of reconnect timer and heartbeat messages
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 22 Oct 2025 15:53:24 +0000 (17:53 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Thu, 30 Oct 2025 13:32:10 +0000 (14:32 +0100)
commit7bc7d06ce5a520c26ba17b4be232cbf9ee3e1ed4
tree1d1fd9fa16716869a7c55a1cdd42df8d5a307651
parent41dfd28da340fdabca5dc4038f987216ac08fb0e
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 a periodic wakeup may be uselessly performed.
So, in this patch, the reconnect timer is rearmed each time a message is
received.

Finally, to have waiting to long to reconnect when a peer session is closed,
the reconnect timeout is rearmed with a low value when the peer applet is
released.
src/peers.c