Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tm2/pkg/p2p/switch_duplicate_ip_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ func TestSwitchClosesRejectedDuplicateIPConn(t *testing.T) {
// The first connection takes the only slot this IP gets.
dialAndStart(t, serverTr, "first", make(chan error, 1))

// Wait for the first to occupy the slot. The transport hands handshaked
// connections to the switch in completion order, so the second may
// otherwise get there first and the first is the one rejected.
require.Eventually(t, func() bool {
return sw.Peers().NumInbound() == 1
}, 10*time.Second, 20*time.Millisecond)

// The second is rejected. Our end must notice.
rejected := make(chan error, 1)
dialAndStart(t, serverTr, "second", rejected)
Expand Down
Loading