mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Simplify reconfiguration
This commit is contained in:
parent
764f9c8e11
commit
fc9a1c6c31
13 changed files with 64 additions and 141 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue