Update Server State on ServerStateChangeEvent in addition to individual groups. #364

Merged
dan merged 4 commits from message_flags into master 2021-06-10 17:56:36 +00:00
1 changed files with 4 additions and 0 deletions
Showing only changes of commit 957558165d - Show all commits

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]