Use regular mutex instead (less type assertions)

This reverts commit 5ba9dadc49.
This commit is contained in:
Neil Alexander 2023-05-20 18:36:44 +01:00
parent 5ba9dadc49
commit e0b39b303f
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
2 changed files with 39 additions and 29 deletions

View file

@ -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
}