From 7b1678a11d6261e4adc9c7c62489bf644f75a3fa Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 19 Sep 2019 09:04:25 +0100 Subject: [PATCH] Goroutines in _addPeerLoop from bugfixes --- src/yggdrasil/core.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/yggdrasil/core.go b/src/yggdrasil/core.go index 907db699..42910aa7 100644 --- a/src/yggdrasil/core.go +++ b/src/yggdrasil/core.go @@ -92,17 +92,21 @@ func (c *Core) _addPeerLoop() { // Add peers from the Peers section for _, peer := range current.Peers { - if err := c.CallPeer(peer, ""); err != nil { - c.log.Errorln("Failed to add peer:", err) - } + go func(peer, intf string) { + if err := c.CallPeer(peer, intf); err != nil { + c.log.Errorln("Failed to add peer:", err) + } + }(peer, "") } // Add peers from the InterfacePeers section for intf, intfpeers := range current.InterfacePeers { for _, peer := range intfpeers { - if err := c.CallPeer(peer, intf); err != nil { - c.log.Errorln("Failed to add peer:", err) - } + go func(peer, intf string) { + if err := c.CallPeer(peer, intf); err != nil { + c.log.Errorln("Failed to add peer:", err) + } + }(peer, intf) } }