Handle errors from reconfigure tasks

This commit is contained in:
Neil Alexander 2018-12-30 12:04:42 +00:00
parent 2925920c70
commit 7fae1c993a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
9 changed files with 64 additions and 72 deletions

View file

@ -162,7 +162,7 @@ type switchData struct {
// All the information stored by the switch.
type switchTable struct {
core *Core
reconfigure chan bool
reconfigure chan chan error
key crypto.SigPubKey // Our own key
time time.Time // Time when locator.tstamp was last updated
drop map[crypto.SigPubKey]int64 // Tstamp associated with a dropped root
@ -185,7 +185,7 @@ const SwitchQueueTotalMinSize = 4 * 1024 * 1024
func (t *switchTable) init(core *Core) {
now := time.Now()
t.core = core
t.reconfigure = make(chan bool, 1)
t.reconfigure = make(chan chan error, 1)
t.core.configMutex.RLock()
t.key = t.core.sigPub
t.core.configMutex.RUnlock()
@ -812,11 +812,8 @@ func (t *switchTable) doWorker() {
}
case f := <-t.admin:
f()
case _ = <-t.reconfigure:
t.core.configMutex.RLock()
t.core.log.Println("Notified: switchTable")
t.core.configMutex.RUnlock()
continue
case e := <-t.reconfigure:
e <- nil
}
}
}