Send a status notification on offline peers change (#821)

Sum offline peers too
This commit is contained in:
Maycon Santos 2023-04-20 15:59:07 +02:00 committed by GitHub
parent bb147c2a7c
commit 118880b6f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,6 +78,7 @@ func (d *Status) ReplaceOfflinePeers(replacement []State) {
defer d.mux.Unlock() defer d.mux.Unlock()
d.offlinePeers = make([]State, len(replacement)) d.offlinePeers = make([]State, len(replacement))
copy(d.offlinePeers, replacement) copy(d.offlinePeers, replacement)
d.notifyPeerListChanged()
} }
// AddPeer adds peer to Daemon status map // AddPeer adds peer to Daemon status map
@ -308,7 +309,7 @@ func (d *Status) onConnectionChanged() {
} }
func (d *Status) notifyPeerListChanged() { func (d *Status) notifyPeerListChanged() {
d.notifier.peerListChanged(len(d.peers)) d.notifier.peerListChanged(len(d.peers) + len(d.offlinePeers))
} }
func (d *Status) notifyAddressChanged() { func (d *Status) notifyAddressChanged() {