forked from quic-go/quic-go
convert ReceiveStream interface to a struct (#5173)
This commit is contained in:
@@ -84,7 +84,7 @@ func newClientConn(
|
||||
enableDatagrams bool,
|
||||
additionalSettings map[uint64]uint64,
|
||||
streamHijacker func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error),
|
||||
uniStreamHijacker func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool),
|
||||
uniStreamHijacker func(StreamType, quic.ConnectionTracingID, *quic.ReceiveStream, error) (hijacked bool),
|
||||
maxResponseHeaderBytes int64,
|
||||
disableCompression bool,
|
||||
logger *slog.Logger,
|
||||
|
||||
@@ -537,7 +537,7 @@ func testClientStreamHijacking(t *testing.T, bidirectional, doHijack bool, strea
|
||||
return true, nil
|
||||
}
|
||||
case false:
|
||||
tr.UniStreamHijacker = func(st StreamType, id quic.ConnectionTracingID, rs quic.ReceiveStream, e error) (hijacked bool) {
|
||||
tr.UniStreamHijacker = func(st StreamType, id quic.ConnectionTracingID, rs *quic.ReceiveStream, e error) (hijacked bool) {
|
||||
hijackChan <- hijackCall{st: st, connTracingID: id, e: e}
|
||||
return doHijack
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ func (c *connection) CloseWithError(code quic.ApplicationErrorCode, msg string)
|
||||
return c.Connection.CloseWithError(code, msg)
|
||||
}
|
||||
|
||||
func (c *connection) handleUnidirectionalStreams(hijack func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool)) {
|
||||
func (c *connection) handleUnidirectionalStreams(hijack func(StreamType, quic.ConnectionTracingID, *quic.ReceiveStream, error) (hijacked bool)) {
|
||||
var (
|
||||
rcvdControlStr atomic.Bool
|
||||
rcvdQPACKEncoderStr atomic.Bool
|
||||
@@ -225,7 +225,7 @@ func (c *connection) handleUnidirectionalStreams(hijack func(StreamType, quic.Co
|
||||
return
|
||||
}
|
||||
|
||||
go func(str quic.ReceiveStream) {
|
||||
go func(str *quic.ReceiveStream) {
|
||||
streamType, err := quicvarint.Read(quicvarint.NewReader(str))
|
||||
if err != nil {
|
||||
id := c.Context().Value(quic.ConnectionTracingKey).(quic.ConnectionTracingID)
|
||||
@@ -286,7 +286,7 @@ func (c *connection) handleUnidirectionalStreams(hijack func(StreamType, quic.Co
|
||||
}
|
||||
}
|
||||
|
||||
func (c *connection) handleControlStream(str quic.ReceiveStream) {
|
||||
func (c *connection) handleControlStream(str *quic.ReceiveStream) {
|
||||
fp := &frameParser{conn: c.Connection, r: str}
|
||||
f, err := fp.ParseNext()
|
||||
if err != nil {
|
||||
|
||||
@@ -133,7 +133,12 @@ func newConnPairWithDatagrams(t *testing.T) (client, server quic.EarlyConnection
|
||||
return cl, conn
|
||||
}
|
||||
|
||||
func expectStreamReadReset(t *testing.T, str quic.ReceiveStream, errCode quic.StreamErrorCode) {
|
||||
type quicReceiveStream interface {
|
||||
io.Reader
|
||||
SetReadDeadline(time.Time) error
|
||||
}
|
||||
|
||||
func expectStreamReadReset(t *testing.T, str quicReceiveStream, errCode quic.StreamErrorCode) {
|
||||
t.Helper()
|
||||
|
||||
str.SetReadDeadline(time.Now().Add(time.Second))
|
||||
|
||||
@@ -161,7 +161,7 @@ type Server struct {
|
||||
// UniStreamHijacker, when set, is called for unknown unidirectional stream of unknown stream type.
|
||||
// If parsing the stream type fails, the error is passed to the callback.
|
||||
// In that case, the stream type will not be set.
|
||||
UniStreamHijacker func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool)
|
||||
UniStreamHijacker func(StreamType, quic.ConnectionTracingID, *quic.ReceiveStream, error) (hijacked bool)
|
||||
|
||||
// IdleTimeout specifies how long until idle clients connection should be
|
||||
// closed. Idle refers only to the HTTP/3 layer, activity at the QUIC layer
|
||||
|
||||
@@ -495,7 +495,7 @@ func testServerHijackBidirectionalStream(t *testing.T, bidirectional bool, doHij
|
||||
hijackChan <- hijackCall{ft: ft, connTracingID: connTracingID, e: e}
|
||||
return doHijack, hijackErr
|
||||
},
|
||||
UniStreamHijacker: func(st StreamType, connTracingID quic.ConnectionTracingID, _ quic.ReceiveStream, err error) bool {
|
||||
UniStreamHijacker: func(st StreamType, connTracingID quic.ConnectionTracingID, _ *quic.ReceiveStream, err error) bool {
|
||||
defer close(testDone)
|
||||
hijackChan <- hijackCall{st: st, connTracingID: connTracingID, e: err}
|
||||
return doHijack
|
||||
|
||||
@@ -99,7 +99,7 @@ type Transport struct {
|
||||
DisableCompression bool
|
||||
|
||||
StreamHijacker func(FrameType, quic.ConnectionTracingID, *quic.Stream, error) (hijacked bool, err error)
|
||||
UniStreamHijacker func(StreamType, quic.ConnectionTracingID, quic.ReceiveStream, error) (hijacked bool)
|
||||
UniStreamHijacker func(StreamType, quic.ConnectionTracingID, *quic.ReceiveStream, error) (hijacked bool)
|
||||
|
||||
Logger *slog.Logger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user