Skip to content

Commit

Permalink
print drops from routing table.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Sep 6, 2018
1 parent 18e7410 commit 4acf71e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion table.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func NewRoutingTable(bucketsize int, localID ID, latency time.Duration, m pstore
PeerAdded: func(peer.ID) {},
}

fmt.Println("built DHT table")
return rt
}

Expand Down Expand Up @@ -91,8 +92,10 @@ func (rt *RoutingTable) Update(p peer.ID) {
if bucketID == len(rt.Buckets)-1 {
rt.nextBucket()
} else {
dropped := bucket.PopBack()
fmt.Printf("[bucketid=%d] old peer dropped in favour of incoming peer, dropped: %v, new: %v\n", bucketID, dropped.String(), p.String())
// If the bucket cant split kick out least active node
rt.PeerRemoved(bucket.PopBack())
rt.PeerRemoved(dropped)
}
}
}
Expand Down

0 comments on commit 4acf71e

Please sign in to comment.