mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2024-11-22 18:50:27 +00:00
fix leak in _addPeerLoop
This commit is contained in:
parent
92d9274f3f
commit
995d67cca8
@ -93,7 +93,7 @@ func (c *Core) _addPeerLoop() {
|
|||||||
// Add peers from the Peers section
|
// Add peers from the Peers section
|
||||||
for _, peer := range current.Peers {
|
for _, peer := range current.Peers {
|
||||||
go func(peer, intf string) {
|
go func(peer, intf string) {
|
||||||
if err := c.AddPeer(peer, intf); err != nil {
|
if err := c.CallPeer(peer, intf); err != nil {
|
||||||
c.log.Errorln("Failed to add peer:", err)
|
c.log.Errorln("Failed to add peer:", err)
|
||||||
}
|
}
|
||||||
}(peer, "") // TODO: this should be acted and not in a goroutine?
|
}(peer, "") // TODO: this should be acted and not in a goroutine?
|
||||||
@ -103,7 +103,7 @@ func (c *Core) _addPeerLoop() {
|
|||||||
for intf, intfpeers := range current.InterfacePeers {
|
for intf, intfpeers := range current.InterfacePeers {
|
||||||
for _, peer := range intfpeers {
|
for _, peer := range intfpeers {
|
||||||
go func(peer, intf string) {
|
go func(peer, intf string) {
|
||||||
if err := c.AddPeer(peer, intf); err != nil {
|
if err := c.CallPeer(peer, intf); err != nil {
|
||||||
c.log.Errorln("Failed to add peer:", err)
|
c.log.Errorln("Failed to add peer:", err)
|
||||||
}
|
}
|
||||||
}(peer, intf) // TODO: this should be acted and not in a goroutine?
|
}(peer, intf) // TODO: this should be acted and not in a goroutine?
|
||||||
@ -111,7 +111,7 @@ func (c *Core) _addPeerLoop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
c.addPeerTimer = time.AfterFunc(time.Minute, func() {
|
c.addPeerTimer = time.AfterFunc(time.Minute, func() {
|
||||||
c.Act(c, c._addPeerLoop)
|
c.Act(nil, c._addPeerLoop)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user