http3: qlog sent and received DATAGRAMs (#5375)

This commit is contained in:
Marten Seemann
2025-10-11 20:14:06 +08:00
committed by GitHub
parent f330d0e257
commit ed194a0c5e
4 changed files with 103 additions and 5 deletions

View File

@@ -187,7 +187,7 @@ func newConnPairWithRecorder(t *testing.T, clientRecorder, serverRecorder qlogwr
return cl, conn
}
func newConnPairWithDatagrams(t *testing.T) (client, server *quic.Conn) {
func newConnPairWithDatagrams(t *testing.T, clientRecorder, serverRecorder qlogwriter.Recorder) (client, server *quic.Conn) {
t.Helper()
ln, err := quic.ListenEarly(
@@ -197,13 +197,27 @@ func newConnPairWithDatagrams(t *testing.T) (client, server *quic.Conn) {
InitialStreamReceiveWindow: maxByteCount,
InitialConnectionReceiveWindow: maxByteCount,
EnableDatagrams: true,
Tracer: func(ctx context.Context, isClient bool, connID quic.ConnectionID) qlogwriter.Trace {
return &qlogTrace{recorder: serverRecorder}
},
},
)
require.NoError(t, err)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
cl, err := quic.DialEarly(ctx, newUDPConnLocalhost(t), ln.Addr(), getTLSClientConfig(), &quic.Config{EnableDatagrams: true})
cl, err := quic.DialEarly(
ctx,
newUDPConnLocalhost(t),
ln.Addr(),
getTLSClientConfig(),
&quic.Config{
EnableDatagrams: true,
Tracer: func(ctx context.Context, isClient bool, connID quic.ConnectionID) qlogwriter.Trace {
return &qlogTrace{recorder: clientRecorder}
},
},
)
require.NoError(t, err)
t.Cleanup(func() { cl.CloseWithError(0, "") })