Class: Protocol::HTTP2::LocalWindow
- Defined in:
- lib/protocol/http2/window_update_frame.rb
Overview
This is a window which efficiently maintains a desired capacity.
Instance Attribute Summary collapse
-
#desired ⇒ Object
Returns the value of attribute desired.
Attributes inherited from Window
Instance Method Summary collapse
-
#initialize(capacity = 0xFFFF, desired: nil) ⇒ LocalWindow
constructor
A new instance of LocalWindow.
- #limited? ⇒ Boolean
- #wanted ⇒ Object
Methods inherited from Window
#available?, #consume, #expand, #full?, #to_s
Constructor Details
#initialize(capacity = 0xFFFF, desired: nil) ⇒ LocalWindow
Returns a new instance of LocalWindow.
87 88 89 90 91 |
# File 'lib/protocol/http2/window_update_frame.rb', line 87 def initialize(capacity = 0xFFFF, desired: nil) super(capacity) @desired = desired end |
Instance Attribute Details
#desired ⇒ Object
Returns the value of attribute desired.
93 94 95 |
# File 'lib/protocol/http2/window_update_frame.rb', line 93 def desired @desired end |
Instance Method Details
#limited? ⇒ Boolean
104 105 106 |
# File 'lib/protocol/http2/window_update_frame.rb', line 104 def limited? @available < ((@desired || @capacity) / 2) end |
#wanted ⇒ Object
95 96 97 98 99 100 101 102 |
# File 'lib/protocol/http2/window_update_frame.rb', line 95 def wanted if @desired # We must send an update which allows at least @desired bytes to be sent. (@desired - @capacity) + @used else @used end end |