Merge pull request #3745 from quic-go/aggressive-key-updates

initiate the first key update after sending / receiving 100 packets
This commit is contained in:
Marten Seemann 2023-04-19 16:28:33 +02:00 committed by GitHub
commit 379e7ec848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 29 deletions

View file

@ -51,12 +51,14 @@ func (t *keyUpdateConnTracer) ReceivedShortHeaderPacket(hdr *logging.ShortHeader
}
var _ = Describe("Key Update tests", func() {
var server quic.Listener
It("downloads a large file", func() {
origKeyUpdateInterval := handshake.KeyUpdateInterval
defer func() { handshake.KeyUpdateInterval = origKeyUpdateInterval }()
handshake.KeyUpdateInterval = 1 // update keys as frequently as possible
runServer := func() {
var err error
server, err = quic.ListenAddr("localhost:0", getTLSConfig(), nil)
server, err := quic.ListenAddr("localhost:0", getTLSConfig(), nil)
Expect(err).ToNot(HaveOccurred())
defer server.Close()
go func() {
defer GinkgoRecover()
@ -68,14 +70,7 @@ var _ = Describe("Key Update tests", func() {
_, err = str.Write(PRDataLong)
Expect(err).ToNot(HaveOccurred())
}()
}
It("downloads a large file", func() {
origKeyUpdateInterval := handshake.KeyUpdateInterval
defer func() { handshake.KeyUpdateInterval = origKeyUpdateInterval }()
handshake.KeyUpdateInterval = 1 // update keys as frequently as possible
runServer()
conn, err := quic.DialAddr(
fmt.Sprintf("localhost:%d", server.Addr().(*net.UDPAddr).Port),
getTLSClientConfig(),