forked from quic-go/quic-go
convert SendStream to a struct (#5172)
This commit is contained in:
10
framer.go
10
framer.go
@@ -22,6 +22,10 @@ const (
|
||||
// (which is the RESET_STREAM frame).
|
||||
const maxStreamControlFrameSize = 25
|
||||
|
||||
type streamFrameGetter interface {
|
||||
popStreamFrame(protocol.ByteCount, protocol.Version) (ackhandler.StreamFrame, *wire.StreamDataBlockedFrame, bool)
|
||||
}
|
||||
|
||||
type streamControlFrameGetter interface {
|
||||
getControlFrame(time.Time) (_ ackhandler.Frame, ok, hasMore bool)
|
||||
}
|
||||
@@ -29,7 +33,7 @@ type streamControlFrameGetter interface {
|
||||
type framer struct {
|
||||
mutex sync.Mutex
|
||||
|
||||
activeStreams map[protocol.StreamID]sendStreamI
|
||||
activeStreams map[protocol.StreamID]streamFrameGetter
|
||||
streamQueue ringbuffer.RingBuffer[protocol.StreamID]
|
||||
streamsWithControlFrames map[protocol.StreamID]streamControlFrameGetter
|
||||
|
||||
@@ -42,7 +46,7 @@ type framer struct {
|
||||
|
||||
func newFramer(connFlowController flowcontrol.ConnectionFlowController) *framer {
|
||||
return &framer{
|
||||
activeStreams: make(map[protocol.StreamID]sendStreamI),
|
||||
activeStreams: make(map[protocol.StreamID]streamFrameGetter),
|
||||
streamsWithControlFrames: make(map[protocol.StreamID]streamControlFrameGetter),
|
||||
connFlowController: connFlowController,
|
||||
}
|
||||
@@ -214,7 +218,7 @@ func (f *framer) QueuedTooManyControlFrames() bool {
|
||||
return f.queuedTooManyControlFrames
|
||||
}
|
||||
|
||||
func (f *framer) AddActiveStream(id protocol.StreamID, str sendStreamI) {
|
||||
func (f *framer) AddActiveStream(id protocol.StreamID, str streamFrameGetter) {
|
||||
f.mutex.Lock()
|
||||
if _, ok := f.activeStreams[id]; !ok {
|
||||
f.streamQueue.PushBack(id)
|
||||
|
||||
Reference in New Issue
Block a user