improve peer gc efficiency
Instead of separately calculating routes to every individual peer, carry out one calculation for routes to all peers. Same as unicast routes except taking into account asymmetric connections.
This commit is contained in:
1 parent
6c934f1cd3
commit
d88c12caa7
1 file changed
+2
-2
+2
-2
@@ -147,9 +147,9 @@ func (peers *Peers) fetchAlias(peer *Peer) (*Peer, bool) {
|
||||
|
||||
func (peers *Peers) garbageCollect() []*Peer {
|
||||
removed := []*Peer{}
|
||||
_, reachable := peers.ourself.Routes(nil, false)
|
||||
for name, peer := range peers.table {
|
||||
found, _ := peers.ourself.Routes(peer, false)
|
||||
if !found && !peer.IsLocallyReferenced() {
|
||||
if _, found := reachable[peer.Name]; !found && !peer.IsLocallyReferenced() {
|
||||
delete(peers.table, name)
|
||||
peers.onGC(peer)
|
||||
removed = append(removed, peer)
|
||||
|
||||
Reference in new issue
Block a user