mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-24 02:25:21 +00:00
Merge pull request #310 from neilalexander/nodeconfig
Bug fixes from nodeconfig branch
This commit is contained in:
commit
c3bd3bd140
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user