forked from quic-go/quic-go
introduce Transport.ConnContext, use client's context on the connection (#4507)
* introduce Transport.ConnContext, use client's context on the connection * panic if ConnContext returns nil
This commit is contained in:
11
transport.go
11
transport.go
@@ -89,6 +89,16 @@ type Transport struct {
|
||||
// implementation of this callback (negating its return value).
|
||||
VerifySourceAddress func(net.Addr) bool
|
||||
|
||||
// ConnContext is called when the server accepts a new connection.
|
||||
// The context returned from the callback is used to derive every other context used during the
|
||||
// lifetime of the connection:
|
||||
// * the context passed to crypto/tls (and used on the tls.ClientHelloInfo)
|
||||
// * the context used in Config.Tracer
|
||||
// * the context returned from Connection.Context
|
||||
// * the context returned from SendStream.Context
|
||||
// It is not used for dialed connections.
|
||||
ConnContext func() context.Context
|
||||
|
||||
// A Tracer traces events that don't belong to a single QUIC connection.
|
||||
// Tracer.Close is called when the transport is closed.
|
||||
Tracer *logging.Tracer
|
||||
@@ -168,6 +178,7 @@ func (t *Transport) createServer(tlsConf *tls.Config, conf *Config, allow0RTT bo
|
||||
t.conn,
|
||||
t.handlerMap,
|
||||
t.connIDGenerator,
|
||||
t.ConnContext,
|
||||
tlsConf,
|
||||
conf,
|
||||
t.Tracer,
|
||||
|
||||
Reference in New Issue
Block a user