refactor and explain route calculation
This was rather impenetrable and had some significant code duplication. So add some words of explanation, and refactor to remove the duplication. Some fly-by fixing of minor bug too: buildUnicastRoutes failed to exclude asymmetric connections from the first hop.
This commit is contained in:
1 parent
89a1e0fb24
commit
c4a64c8649
3 files changed
+74
-70
No files matched your search
@@ -131,7 +131,7 @@ func (cache *PeerCache) fetchAlias(peer *Peer) (*Peer, bool) {
|
||||
func (cache *PeerCache) garbageCollect(ourself *Peer) []*Peer {
|
||||
removed := []*Peer{}
|
||||
for name, peer := range cache.table {
|
||||
found, _ := ourself.HasPathTo(peer, false)
|
||||
found, _ := ourself.Routes(peer, false)
|
||||
if !found && !peer.IsLocallyReferenced() {
|
||||
cache.onGC(peer)
|
||||
delete(cache.table, name)
|
||||
|
||||
Reference in new issue
Block a user