interface.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package flowcontrol
  2. import "v2ray.com/core/external/github.com/lucas-clemente/quic-go/internal/protocol"
  3. type flowController interface {
  4. // for sending
  5. SendWindowSize() protocol.ByteCount
  6. UpdateSendWindow(protocol.ByteCount)
  7. AddBytesSent(protocol.ByteCount)
  8. // for receiving
  9. AddBytesRead(protocol.ByteCount)
  10. GetWindowUpdate() protocol.ByteCount // returns 0 if no update is necessary
  11. MaybeQueueWindowUpdate() // queues a window update, if necessary
  12. IsNewlyBlocked() (bool, protocol.ByteCount)
  13. }
  14. // A StreamFlowController is a flow controller for a QUIC stream.
  15. type StreamFlowController interface {
  16. flowController
  17. // for receiving
  18. // UpdateHighestReceived should be called when a new highest offset is received
  19. // 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
  20. UpdateHighestReceived(offset protocol.ByteCount, final bool) error
  21. }
  22. // The ConnectionFlowController is the flow controller for the connection.
  23. type ConnectionFlowController interface {
  24. flowController
  25. }
  26. type connectionFlowControllerI interface {
  27. ConnectionFlowController
  28. // The following two methods are not supposed to be called from outside this packet, but are needed internally
  29. // for sending
  30. EnsureMinimumWindowSize(protocol.ByteCount)
  31. // for receiving
  32. IncrementHighestReceived(protocol.ByteCount) error
  33. }