mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 22:25:07 +03:00
Use regular mutex instead (less type assertions)
This reverts commit 5ba9dadc49
.
This commit is contained in:
parent
5ba9dadc49
commit
e0b39b303f
2 changed files with 39 additions and 29 deletions
|
@ -71,9 +71,9 @@ func (c *Core) GetPeers() []PeerInfo {
|
|||
conns[p.Conn] = p
|
||||
}
|
||||
|
||||
c.links.links.Range(func(key, value any) bool {
|
||||
info := key.(linkInfo)
|
||||
state := value.(*link)
|
||||
c.links.RLock()
|
||||
defer c.links.RUnlock()
|
||||
for info, state := range c.links._links {
|
||||
var peerinfo PeerInfo
|
||||
var conn net.Conn
|
||||
phony.Block(state, func() {
|
||||
|
@ -96,8 +96,7 @@ func (c *Core) GetPeers() []PeerInfo {
|
|||
peerinfo.Priority = p.Priority
|
||||
}
|
||||
peers = append(peers, peerinfo)
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
return peers
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue