Update Server State on ServerStateChangeEvent in addition to individual groups.
This commit is contained in:
parent
05f7dbcda8
commit
957558165d
|
@ -811,6 +811,10 @@ func (cp *cwtchPeer) eventHandler() {
|
||||||
cp.mutex.Unlock()
|
cp.mutex.Unlock()
|
||||||
case event.ServerStateChange:
|
case event.ServerStateChange:
|
||||||
cp.mutex.Lock()
|
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 {
|
for _, group := range cp.Profile.Groups {
|
||||||
if group.GroupServer == ev.Data[event.GroupServer] {
|
if group.GroupServer == ev.Data[event.GroupServer] {
|
||||||
group.State = ev.Data[event.ConnectionState]
|
group.State = ev.Data[event.ConnectionState]
|
||||||
|
|
Loading…
Reference in New Issue