delete closed connections after 3 PTOs (#5117)

In most cases, this should be earlier than the current
timeout value of 5s.
This commit is contained in:
Marten Seemann
2025-05-04 18:51:39 +08:00
committed by GitHub
parent be709c10fd
commit 9b3ff059fc
10 changed files with 49 additions and 56 deletions

View File

@@ -31,7 +31,7 @@ func TestConnectionCloseRetransmission(t *testing.T) {
Conn: newUDPConnLocalhost(t),
ServerAddr: server.Addr().(*net.UDPAddr),
DelayPacket: func(quicproxy.Direction, net.Addr, net.Addr, []byte) time.Duration {
return 5 * time.Millisecond // 10ms RTT
return scaleDuration(5 * time.Millisecond) // 10ms RTT
},
DropPacket: func(dir quicproxy.Direction, _, _ net.Addr, b []byte) bool {
if drop := drop.Load(); drop && dir == quicproxy.DirectionOutgoing {
@@ -57,7 +57,7 @@ func TestConnectionCloseRetransmission(t *testing.T) {
sconn.CloseWithError(1337, "closing")
// send 100 packets
for i := 0; i < 100; i++ {
for range 100 {
str, err := conn.OpenStream()
require.NoError(t, err)
_, err = str.Write([]byte("foobar"))
@@ -68,7 +68,7 @@ func TestConnectionCloseRetransmission(t *testing.T) {
// Expect retransmissions of the CONNECTION_CLOSE for the
// 1st, 2nd, 4th, 8th, 16th, 32th, 64th packet: 7 in total (+1 for the original packet)
var packets [][]byte
for i := 0; i < 8; i++ {
for range 8 {
select {
case p := <-dropped:
packets = append(packets, p)