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:
Matthias Radestock committed 2014-11-30 16:04:55 +00:00
1 parent 89a1e0fb24
commit c4a64c8649
3 files changed
+74 -70

No files matched your search

+1 -1
View File
@@ -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)