diff --git a/src/yggdrasil/router.go b/src/yggdrasil/router.go index 11509d44..31eefbb2 100644 --- a/src/yggdrasil/router.go +++ b/src/yggdrasil/router.go @@ -86,6 +86,7 @@ func (r *router) init(core *Core) { r.send = send r.reset = make(chan struct{}, 1) r.admin = make(chan func(), 32) + r.nodeinfo.init(r.core) r.core.configMutex.RLock() r.nodeinfo.setNodeInfo(r.core.config.NodeInfo, r.core.config.NodeInfoPrivacy) r.core.configMutex.RUnlock() diff --git a/src/yggdrasil/tcp.go b/src/yggdrasil/tcp.go index c90c3ffb..1ebf0b69 100644 --- a/src/yggdrasil/tcp.go +++ b/src/yggdrasil/tcp.go @@ -125,8 +125,10 @@ func (iface *tcpInterface) listen() error { } iface.serv, err = lc.Listen(ctx, "tcp", iface.tcp_addr) if err == nil { + iface.mutex.Lock() iface.calls = make(map[string]struct{}) iface.conns = make(map[tcpInfo](chan struct{})) + iface.mutex.Unlock() go iface.listener() return nil } @@ -187,7 +189,9 @@ func (iface *tcpInterface) call(saddr string, socksaddr *string, sintf string) { if iface.isAlreadyCalling(saddr) { return } + iface.mutex.Lock() iface.calls[callname] = struct{}{} + iface.mutex.Unlock() defer func() { // Block new calls for a little while, to mitigate livelock scenarios time.Sleep(default_tcp_timeout)