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
This commit is contained in:
Maycon Santos 2023-06-17 09:03:52 +02:00 committed by GitHub
parent 09ca2d222a
commit a4350c19e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}