forked from quic-go/quic-go
The stream always gets blocked at the current write offset. There's no need to return this offset from the flow controller.
44 lines
1.5 KiB
Go
44 lines
1.5 KiB
Go
package flowcontrol
|
|
|
|
import "github.com/quic-go/quic-go/internal/protocol"
|
|
|
|
type flowController interface {
|
|
// for sending
|
|
SendWindowSize() protocol.ByteCount
|
|
UpdateSendWindow(protocol.ByteCount) (updated bool)
|
|
AddBytesSent(protocol.ByteCount)
|
|
// for receiving
|
|
GetWindowUpdate() protocol.ByteCount // returns 0 if no update is necessary
|
|
}
|
|
|
|
// A StreamFlowController is a flow controller for a QUIC stream.
|
|
type StreamFlowController interface {
|
|
flowController
|
|
AddBytesRead(protocol.ByteCount) (shouldQueueWindowUpdate bool)
|
|
// 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 is called when reading from the stream is aborted early,
|
|
// and there won't be any further calls to AddBytesRead.
|
|
Abandon()
|
|
IsNewlyBlocked() bool
|
|
}
|
|
|
|
// The ConnectionFlowController is the flow controller for the connection.
|
|
type ConnectionFlowController interface {
|
|
flowController
|
|
AddBytesRead(protocol.ByteCount)
|
|
Reset() error
|
|
IsNewlyBlocked() (bool, protocol.ByteCount)
|
|
}
|
|
|
|
type connectionFlowControllerI interface {
|
|
ConnectionFlowController
|
|
// The following two methods are not supposed to be called from outside this packet, but are needed internally
|
|
// for sending
|
|
EnsureMinimumWindowSize(protocol.ByteCount)
|
|
// for receiving
|
|
IncrementHighestReceived(protocol.ByteCount) error
|
|
}
|