4
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2025-07-13 17:36:28 +00:00

Handle errors from reconfigure tasks

This commit is contained in:
Neil Alexander
2018-12-30 12:04:42 +00:00
parent 2925920c70
commit 7fae1c993a
9 changed files with 64 additions and 72 deletions

View File

@ -19,7 +19,7 @@ import (
// In other cases, it's link protocol traffic used to build the spanning tree, in which case this checks signatures and passes the message along to the switch.
type peers struct {
core *Core
reconfigure chan bool
reconfigure chan chan error
mutex sync.Mutex // Synchronize writes to atomic
ports atomic.Value //map[switchPort]*peer, use CoW semantics
authMutex sync.RWMutex
@ -32,15 +32,12 @@ func (ps *peers) init(c *Core) {
defer ps.mutex.Unlock()
ps.putPorts(make(map[switchPort]*peer))
ps.core = c
ps.reconfigure = make(chan bool, 1)
ps.reconfigure = make(chan chan error, 1)
go func() {
for {
select {
case _ = <-ps.reconfigure:
ps.core.configMutex.RLock()
ps.core.log.Println("Notified: peers")
ps.core.configMutex.RUnlock()
continue
case e := <-ps.reconfigure:
e <- nil
}
}
}()