introduce a quic.Config.HandshakeIdleTimeout, remove HandshakeTimeout

This commit is contained in:
Marten Seemann
2020-12-08 16:01:27 +07:00
parent deacefdd34
commit 595f6f814a
15 changed files with 116 additions and 55 deletions

View File

@@ -37,9 +37,9 @@ var _ = Describe("Handshake drop tests", func() {
startListenerAndProxy := func(dropCallback quicproxy.DropCallback, doRetry bool, longCertChain bool, version protocol.VersionNumber) {
conf := getQuicConfig(&quic.Config{
MaxIdleTimeout: timeout,
HandshakeTimeout: timeout,
Versions: []protocol.VersionNumber{version},
MaxIdleTimeout: timeout,
HandshakeIdleTimeout: timeout,
Versions: []protocol.VersionNumber{version},
})
if !doRetry {
conf.AcceptToken = func(net.Addr, *quic.Token) bool { return true }
@@ -88,9 +88,9 @@ var _ = Describe("Handshake drop tests", func() {
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
MaxIdleTimeout: timeout,
HandshakeTimeout: timeout,
Versions: []protocol.VersionNumber{version},
MaxIdleTimeout: timeout,
HandshakeIdleTimeout: timeout,
Versions: []protocol.VersionNumber{version},
}),
)
Expect(err).ToNot(HaveOccurred())
@@ -126,9 +126,9 @@ var _ = Describe("Handshake drop tests", func() {
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
MaxIdleTimeout: timeout,
HandshakeTimeout: timeout,
Versions: []protocol.VersionNumber{version},
MaxIdleTimeout: timeout,
HandshakeIdleTimeout: timeout,
Versions: []protocol.VersionNumber{version},
}),
)
Expect(err).ToNot(HaveOccurred())
@@ -159,9 +159,9 @@ var _ = Describe("Handshake drop tests", func() {
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
MaxIdleTimeout: timeout,
HandshakeTimeout: timeout,
Versions: []protocol.VersionNumber{version},
MaxIdleTimeout: timeout,
HandshakeIdleTimeout: timeout,
Versions: []protocol.VersionNumber{version},
}),
)
Expect(err).ToNot(HaveOccurred())

View File

@@ -145,7 +145,7 @@ var _ = Describe("Handshake RTT tests", func() {
serverConfig.AcceptToken = func(_ net.Addr, _ *quic.Token) bool {
return false
}
clientConfig.HandshakeTimeout = 500 * time.Millisecond
clientConfig.HandshakeIdleTimeout = 500 * time.Millisecond
runServerAndProxy()
_, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", proxy.LocalAddr().(*net.UDPAddr).Port),
@@ -153,6 +153,8 @@ var _ = Describe("Handshake RTT tests", func() {
clientConfig,
)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("Handshake did not complete in time"))
nerr, ok := err.(net.Error)
Expect(ok).To(BeTrue())
Expect(nerr.Timeout()).To(BeTrue())
})
})

View File

@@ -336,9 +336,9 @@ var _ = Describe("MITM test", func() {
fmt.Sprintf("localhost:%d", proxy.LocalPort()),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
Versions: []protocol.VersionNumber{version},
ConnectionIDLength: connIDLen,
HandshakeTimeout: 2 * time.Second,
Versions: []protocol.VersionNumber{version},
ConnectionIDLength: connIDLen,
HandshakeIdleTimeout: 2 * time.Second,
}),
)
return err

View File

@@ -66,7 +66,7 @@ var _ = Describe("Timeout tests", func() {
_, err := quic.DialAddr(
"localhost:12345",
getTLSClientConfig(),
getQuicConfig(&quic.Config{HandshakeTimeout: 10 * time.Millisecond}),
getQuicConfig(&quic.Config{HandshakeIdleTimeout: 10 * time.Millisecond}),
)
errChan <- err
}()
@@ -431,8 +431,8 @@ var _ = Describe("Timeout tests", func() {
fmt.Sprintf("localhost:%d", ln.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),
getQuicConfig(&quic.Config{
HandshakeTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
}),
)
if err != nil {
@@ -464,9 +464,9 @@ var _ = Describe("Timeout tests", func() {
"localhost:0",
getTLSConfig(),
getQuicConfig(&quic.Config{
HandshakeTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
KeepAlive: true,
HandshakeIdleTimeout: handshakeTimeout,
MaxIdleTimeout: handshakeTimeout,
KeepAlive: true,
}),
)
Expect(err).ToNot(HaveOccurred())