Skip to content

Commit 8c2c236

Browse files
committed
ensure routing table filters are being applied
1 parent 9461bab commit 8c2c236

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

dht_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,3 +1958,27 @@ func TestInvalidKeys(t *testing.T) {
19581958
t.Fatal("expected to have failed")
19591959
}
19601960
}
1961+
1962+
func TestRoutingFilter(t *testing.T) {
1963+
ctx, cancel := context.WithCancel(context.Background())
1964+
defer cancel()
1965+
1966+
nDHTs := 2
1967+
dhts := setupDHTS(t, ctx, nDHTs)
1968+
defer func() {
1969+
for i := 0; i < nDHTs; i++ {
1970+
dhts[i].Close()
1971+
defer dhts[i].host.Close()
1972+
}
1973+
}()
1974+
dhts[0].routingTablePeerFilter = PublicRoutingTableFilter
1975+
1976+
connectNoSync(t, ctx, dhts[0], dhts[1])
1977+
wait(t, ctx, dhts[1], dhts[0])
1978+
1979+
select {
1980+
case <-ctx.Done():
1981+
t.Fatal(ctx.Err())
1982+
case <-time.After(time.Millisecond * 200):
1983+
}
1984+
}

0 commit comments

Comments
 (0)