start path MTU discovery when the handshake completes

This commit is contained in:
Marten Seemann 2021-01-31 14:27:25 +08:00
parent cb1eab22de
commit ac87292e87
8 changed files with 208 additions and 28 deletions

View file

@ -29,7 +29,10 @@ var _ = Describe("Packetization", func() {
server, err = quic.ListenAddr(
"localhost:0",
getTLSConfig(),
getQuicConfig(&quic.Config{AcceptToken: func(net.Addr, *quic.Token) bool { return true }}),
getQuicConfig(&quic.Config{
AcceptToken: func(net.Addr, *quic.Token) bool { return true },
DisablePathMTUDiscovery: true,
}),
)
Expect(err).ToNot(HaveOccurred())
serverAddr := fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port)
@ -64,7 +67,7 @@ var _ = Describe("Packetization", func() {
sess, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())

View file

@ -130,7 +130,7 @@ var _ = Describe("Timeout tests", func() {
server, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
defer server.Close()
@ -159,7 +159,7 @@ var _ = Describe("Timeout tests", func() {
sess, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout}),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true, MaxIdleTimeout: idleTimeout}),
)
Expect(err).ToNot(HaveOccurred())
strIn, err := sess.AcceptStream(context.Background())
@ -200,7 +200,7 @@ var _ = Describe("Timeout tests", func() {
server, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
defer server.Close()
@ -218,7 +218,11 @@ var _ = Describe("Timeout tests", func() {
sess, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout, Tracer: newTracer(func() logging.ConnectionTracer { return tr })}),
getQuicConfig(&quic.Config{
MaxIdleTimeout: idleTimeout,
Tracer: newTracer(func() logging.ConnectionTracer { return tr }),
DisablePathMTUDiscovery: true,
}),
)
Expect(err).ToNot(HaveOccurred())
done := make(chan struct{})
@ -246,7 +250,7 @@ var _ = Describe("Timeout tests", func() {
server, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
defer server.Close()
@ -276,7 +280,7 @@ var _ = Describe("Timeout tests", func() {
sess, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout}),
getQuicConfig(&quic.Config{MaxIdleTimeout: idleTimeout, DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
@ -317,7 +321,7 @@ var _ = Describe("Timeout tests", func() {
server, err := quic.ListenAddr(
"localhost:0",
getTLSConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
defer server.Close()
@ -345,8 +349,9 @@ var _ = Describe("Timeout tests", func() {
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
MaxIdleTimeout: idleTimeout,
KeepAlive: true,
MaxIdleTimeout: idleTimeout,
KeepAlive: true,
DisablePathMTUDiscovery: true,
}),
)
Expect(err).ToNot(HaveOccurred())
@ -417,7 +422,7 @@ var _ = Describe("Timeout tests", func() {
ln, err := quic.Listen(
&faultyConn{PacketConn: conn, MaxPackets: maxPackets},
getTLSConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
Expect(err).ToNot(HaveOccurred())
@ -434,8 +439,9 @@ var _ = Describe("Timeout tests", func() {
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
DisablePathMTUDiscovery: true,
}),
)
if err != nil {
@ -467,9 +473,10 @@ var _ = Describe("Timeout tests", func() {
"localhost:0",
getTLSConfig(),
getQuicConfig(&quic.Config{
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
KeepAlive: true,
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
KeepAlive: true,
DisablePathMTUDiscovery: true,
}),
)
Expect(err).ToNot(HaveOccurred())
@ -494,7 +501,7 @@ var _ = Describe("Timeout tests", func() {
ln.Addr(),
"localhost",
getTLSClientConfig(),
getQuicConfig(nil),
getQuicConfig(&quic.Config{DisablePathMTUDiscovery: true}),
)
if err != nil {
clientErrChan <- err