http3: move qlogging of frames into the frame parser (#5378)

This commit is contained in:
Marten Seemann
2025-10-12 12:40:24 +08:00
committed by GitHub
parent ed194a0c5e
commit cd4b1307db
13 changed files with 97 additions and 64 deletions

View File

@@ -317,8 +317,8 @@ func (c *Conn) handleUnidirectionalStreams(hijack func(StreamType, quic.Connecti
}
func (c *Conn) handleControlStream(str *quic.ReceiveStream) {
fp := &frameParser{closeConn: c.conn.CloseWithError, r: str}
f, err := fp.ParseNext()
fp := &frameParser{closeConn: c.conn.CloseWithError, r: str, streamID: str.StreamID()}
f, err := fp.ParseNext(c.qlogger)
if err != nil {
var serr *quic.StreamError
if err == io.EOF || errors.As(err, &serr) {
@@ -362,7 +362,7 @@ func (c *Conn) handleControlStream(str *quic.ReceiveStream) {
}
for {
f, err := fp.ParseNext()
f, err := fp.ParseNext(c.qlogger)
if err != nil {
var serr *quic.StreamError
if err == io.EOF || errors.As(err, &serr) {
@@ -380,12 +380,6 @@ func (c *Conn) handleControlStream(str *quic.ReceiveStream) {
c.conn.CloseWithError(quic.ApplicationErrorCode(ErrCodeFrameUnexpected), "")
return
}
if c.qlogger != nil {
c.qlogger.RecordEvent(qlog.FrameParsed{
StreamID: str.StreamID(),
Frame: qlog.Frame{Frame: qlog.GoAwayFrame{StreamID: goaway.StreamID}},
})
}
if goaway.StreamID%4 != 0 { // client-initiated, bidirectional streams
c.conn.CloseWithError(quic.ApplicationErrorCode(ErrCodeIDError), "")
return