update go-tcp-transport to v0.4.0

This commit is contained in:
Marten Seemann 2021-09-29 15:56:41 +01:00
parent 6d9ce0e3cf
commit c3cd06d61c
1 changed files with 6 additions and 2 deletions

View File

@ -126,8 +126,12 @@ func GenSwarm(t *testing.T, opts ...Option) *swarm.Swarm {
upgrader.ConnGater = cfg.connectionGater
if !cfg.disableTCP {
tcpTransport := tcp.NewTCPTransport(upgrader)
tcpTransport.DisableReuseport = cfg.disableReuseport
var tcpOpts []tcp.Option
if cfg.disableReuseport {
tcpOpts = append(tcpOpts, tcp.DisableReuseport())
}
tcpTransport, err := tcp.NewTCPTransport(upgrader, tcpOpts...)
require.NoError(t, err)
if err := s.AddTransport(tcpTransport); err != nil {
t.Fatal(err)
}