Skip to content

Commit

Permalink
testutil: disable TCP port reuse (#3042)
Browse files Browse the repository at this point in the history
During high-load tests on Linux TCP port reuse might happen.

Disable it explicitly to make the test deterministic.

Closes #3041.

category: bug
ticket: #3041
  • Loading branch information
gsora authored Apr 16, 2024
1 parent 62a9492 commit ff6a69b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testutil/random.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/libp2p/go-libp2p"
p2pcrypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/p2p/transport/tcp"
"github.com/multiformats/go-multiaddr"
"github.com/prysmaticlabs/go-bitfield"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -1180,6 +1181,7 @@ func CreateHostWithIdentity(t *testing.T, addr *net.TCPAddr, secret *k1.PrivateK
opts2 := []libp2p.Option{
libp2p.Identity((*p2pcrypto.Secp256k1PrivateKey)(secret)),
libp2p.ListenAddrs(addrs),
libp2p.Transport(tcp.NewTCPTransport, tcp.DisableReuseport()),
}
opts2 = append(opts2, opts...)

Expand Down

0 comments on commit ff6a69b

Please sign in to comment.