expose the connection tracing ID on the stream context (#4414)

This is especially interesting for HTTP servers: They can now learn
which connection a request was received on.
This commit is contained in:
Marten Seemann
2024-04-07 02:41:25 +12:00
committed by GitHub
parent 183d42a729
commit e310b80cf3
8 changed files with 26 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package quic
import (
"context"
"net"
"os"
"sync"
@@ -85,7 +86,9 @@ type stream struct {
var _ Stream = &stream{}
// newStream creates a new Stream
func newStream(streamID protocol.StreamID,
func newStream(
ctx context.Context,
streamID protocol.StreamID,
sender streamSender,
flowController flowcontrol.StreamFlowController,
) *stream {
@@ -99,7 +102,7 @@ func newStream(streamID protocol.StreamID,
s.completedMutex.Unlock()
},
}
s.sendStream = *newSendStream(streamID, senderForSendStream, flowController)
s.sendStream = *newSendStream(ctx, streamID, senderForSendStream, flowController)
senderForReceiveStream := &uniStreamSender{
streamSender: sender,
onStreamCompletedImpl: func() {