Simplify reconfiguration

This commit is contained in:
Neil Alexander 2019-08-28 19:31:04 +01:00
parent 764f9c8e11
commit fc9a1c6c31
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
13 changed files with 64 additions and 141 deletions

View file

@ -73,18 +73,20 @@ func (r *router) init(core *Core) {
r.sessions.init(r)
}
func (r *router) reconfigure(e chan error) {
defer close(e)
var errs []error
// Reconfigures the router and any child modules. This should only ever be run
// by the router actor.
func (r *router) reconfigure() {
// Reconfigure the router
current := r.core.config.GetCurrent()
err := r.nodeinfo.setNodeInfo(current.NodeInfo, current.NodeInfoPrivacy)
if err != nil {
errs = append(errs, err)
}
for _, err := range errs {
e <- err
if err := r.nodeinfo.setNodeInfo(current.NodeInfo, current.NodeInfoPrivacy); err != nil {
r.core.log.Errorln("Error reloading NodeInfo:", err)
} else {
r.core.log.Infoln("NodeInfo updated")
}
// Reconfigure children
r.dht.reconfigure()
r.searches.reconfigure()
r.sessions.reconfigure()
}
// Starts the tickerLoop goroutine.