From a4350c19e7af1ed7b1372164c5edc997d3dae46c Mon Sep 17 00:00:00 2001 From: Maycon Santos Date: Sat, 17 Jun 2023 09:03:52 +0200 Subject: [PATCH] Fix: Skip state notification should use a copy of the previous peer state (#960) This was affecting the behavior of the route manager, causing issues with HA and with cases of flaky connections --- client/internal/peer/status.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/internal/peer/status.go b/client/internal/peer/status.go index e78aa3e5b..3910343dd 100644 --- a/client/internal/peer/status.go +++ b/client/internal/peer/status.go @@ -135,6 +135,8 @@ func (d *Status) UpdatePeerState(receivedState State) error { peerState.IP = receivedState.IP } + skipNotification := shouldSkipNotify(receivedState, peerState) + if receivedState.ConnStatus != peerState.ConnStatus { peerState.ConnStatus = receivedState.ConnStatus peerState.ConnStatusUpdate = receivedState.ConnStatusUpdate @@ -146,7 +148,7 @@ func (d *Status) UpdatePeerState(receivedState State) error { d.peers[receivedState.PubKey] = peerState - if shouldSkipNotify(receivedState, peerState) { + if skipNotification { return nil }