From 957558165d0d75bf535c5fd530686d614eac8314 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 9 Jun 2021 13:20:51 -0700 Subject: [PATCH] Update Server State on ServerStateChangeEvent in addition to individual groups. --- peer/cwtch_peer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/peer/cwtch_peer.go b/peer/cwtch_peer.go index 2dab063..8e924ac 100644 --- a/peer/cwtch_peer.go +++ b/peer/cwtch_peer.go @@ -811,6 +811,10 @@ func (cp *cwtchPeer) eventHandler() { cp.mutex.Unlock() case event.ServerStateChange: cp.mutex.Lock() + // We update both the server contact status, as well as the groups the server belongs to + cp.Profile.Contacts[ev.Data[event.GroupServer]].State = ev.Data[event.ConnectionState] + + // TODO deprecate this, the UI should consult the server contact entry instead (it's far more efficient) for _, group := range cp.Profile.Groups { if group.GroupServer == ev.Data[event.GroupServer] { group.State = ev.Data[event.ConnectionState]