forked from quic-go/quic-go
don't enqueue stream for sending on reordered MAX_STREAM_DATA frames (#4269)
This commit is contained in:
@@ -48,10 +48,12 @@ func (c *baseFlowController) AddBytesSent(n protocol.ByteCount) {
|
||||
}
|
||||
|
||||
// UpdateSendWindow is called after receiving a MAX_{STREAM_}DATA frame.
|
||||
func (c *baseFlowController) UpdateSendWindow(offset protocol.ByteCount) {
|
||||
func (c *baseFlowController) UpdateSendWindow(offset protocol.ByteCount) (updated bool) {
|
||||
if offset > c.sendWindow {
|
||||
c.sendWindow = offset
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *baseFlowController) sendWindowSize() protocol.ByteCount {
|
||||
|
||||
@@ -59,9 +59,9 @@ var _ = Describe("Base Flow controller", func() {
|
||||
})
|
||||
|
||||
It("does not decrease the flow control window", func() {
|
||||
controller.UpdateSendWindow(20)
|
||||
Expect(controller.UpdateSendWindow(20)).To(BeTrue())
|
||||
Expect(controller.sendWindowSize()).To(Equal(protocol.ByteCount(20)))
|
||||
controller.UpdateSendWindow(10)
|
||||
Expect(controller.UpdateSendWindow(10)).To(BeFalse())
|
||||
Expect(controller.sendWindowSize()).To(Equal(protocol.ByteCount(20)))
|
||||
})
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import "github.com/quic-go/quic-go/internal/protocol"
|
||||
type flowController interface {
|
||||
// for sending
|
||||
SendWindowSize() protocol.ByteCount
|
||||
UpdateSendWindow(protocol.ByteCount)
|
||||
UpdateSendWindow(protocol.ByteCount) (updated bool)
|
||||
AddBytesSent(protocol.ByteCount)
|
||||
// for receiving
|
||||
AddBytesRead(protocol.ByteCount)
|
||||
@@ -16,12 +16,11 @@ type flowController interface {
|
||||
// A StreamFlowController is a flow controller for a QUIC stream.
|
||||
type StreamFlowController interface {
|
||||
flowController
|
||||
// for receiving
|
||||
// UpdateHighestReceived should be called when a new highest offset is received
|
||||
// UpdateHighestReceived is called when a new highest offset is received
|
||||
// final has to be to true if this is the final offset of the stream,
|
||||
// as contained in a STREAM frame with FIN bit, and the RESET_STREAM frame
|
||||
UpdateHighestReceived(offset protocol.ByteCount, final bool) error
|
||||
// Abandon should be called when reading from the stream is aborted early,
|
||||
// Abandon is called when reading from the stream is aborted early,
|
||||
// and there won't be any further calls to AddBytesRead.
|
||||
Abandon()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user