class Protocol::HTTP2::LocalWindow
This is a window which efficiently maintains a desired capacity.
def initialize(capacity = DEFAULT_CAPACITY, desired: nil)
def initialize(capacity = DEFAULT_CAPACITY, desired: nil) super(capacity) # The desired capacity of the window, may be bigger than the initial capacity. # If that is the case, we will likely send a window update to the remote end to increase the capacity. @desired = desired end
def inspect
def inspect "\#<#{self.class} available=#{@available} used=#{@used} capacity=#{@capacity} desired=#{@desired} #{limited? ? "limited" : nil}>" end
def limited?
def limited? if @desired # Do not send window updates until we are less than half the desired capacity: @available < (@desired / 2) else super end end
def wanted
def wanted if @desired # We must send an update which allows at least @desired bytes to be sent. (@desired - @capacity) + @used else super end end