mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
fixed removepeers command
This commit is contained in:
parent
8bf66dc0d5
commit
024dddf5a8
1 changed files with 12 additions and 5 deletions
|
@ -234,11 +234,18 @@ func (c *Core) RemovePeer(uri string, sourceInterface string) error {
|
|||
}
|
||||
|
||||
func (c *Core) RemovePeers() error {
|
||||
c.config._peers = map[Peer]*linkInfo{}
|
||||
//for k := range c.config.InterfacePeers {
|
||||
// delete(c.config.InterfacePeers, k)
|
||||
//}
|
||||
|
||||
phony.Block(c, func() {
|
||||
for peer, linkInfo := range c.config._peers {
|
||||
if linkInfo != nil {
|
||||
c.links.Act(nil, func() {
|
||||
if link := c.links._links[*linkInfo]; link != nil {
|
||||
_ = link.close()
|
||||
}
|
||||
})
|
||||
}
|
||||
delete(c.config._peers, peer)
|
||||
}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue