Update Server State on ServerStateChangeEvent in addition to individual groups.

This commit is contained in:
Sarah Jamie Lewis 2021-06-09 13:20:51 -07:00
parent 05f7dbcda8
commit 957558165d
1 changed files with 4 additions and 0 deletions

View File

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