From 5cde3b5efc5ef4b72ae7e6fcba941b68f171a522 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 14 Jan 2019 18:51:49 +0000 Subject: [PATCH] Update nodeinfo in router reconfigure --- src/yggdrasil/admin.go | 5 ++++- src/yggdrasil/router.go | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/yggdrasil/admin.go b/src/yggdrasil/admin.go index 4c864b3a..a44044ad 100644 --- a/src/yggdrasil/admin.go +++ b/src/yggdrasil/admin.go @@ -350,7 +350,10 @@ func (a *admin) init(c *Core) { } var box_pub_key, coords string if in["box_pub_key"] == nil && in["coords"] == nil { - nodeinfo := []byte(a.core.nodeinfo.getNodeInfo()) + var nodeinfo []byte + a.core.router.doAdmin(func() { + nodeinfo = []byte(a.core.nodeinfo.getNodeInfo()) + }) var jsoninfo interface{} if err := json.Unmarshal(nodeinfo, &jsoninfo); err != nil { return admin_info{}, err diff --git a/src/yggdrasil/router.go b/src/yggdrasil/router.go index 68fb025a..b4e16a3a 100644 --- a/src/yggdrasil/router.go +++ b/src/yggdrasil/router.go @@ -127,7 +127,9 @@ func (r *router) mainLoop() { case f := <-r.admin: f() case e := <-r.reconfigure: - e <- nil + r.core.configMutex.RLock() + e <- r.core.nodeinfo.setNodeInfo(r.core.config.NodeInfo, r.core.config.NodeInfoPrivacy) + r.core.configMutex.RUnlock() } } }