routing table should not have all the peers

This commit is contained in:
Aarsh Shah 2019-12-20 15:03:31 +08:00
parent a06b32768e
commit b19ac720dd

View File

@ -805,7 +805,7 @@ func TestEmptyTable(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
defer cancel() defer cancel()
nDHTs := 50 // needs more than 40 peers so we don't add all of them to our routing table. nDHTs := 50
dhts := setupDHTS(t, ctx, nDHTs) dhts := setupDHTS(t, ctx, nDHTs)
defer func() { defer func() {
for _, dht := range dhts { for _, dht := range dhts {
@ -837,6 +837,10 @@ func TestEmptyTable(t *testing.T) {
oldSize = newSize oldSize = newSize
} }
// remove any one peer from the RT so we don't end up disconnecting all of them if the RT
// already has all peers we are connected to
dhts[0].routingTable.Remove(dhts[0].routingTable.ListPeers()[0])
if u.Debug { if u.Debug {
printRoutingTables(dhts[:1]) printRoutingTables(dhts[:1])
} }