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?, #inspect
Constructor Details
#initialize(capacity = 0xFFFF, desired: nil) ⇒ LocalWindow
Returns a new instance of LocalWindow.
80 81 82 83 84 |
# File 'lib/protocol/http2/window_update_frame.rb', line 80 def initialize(capacity = 0xFFFF, desired: nil) super(capacity) @desired = desired end |
Instance Attribute Details
#desired ⇒ Object
Returns the value of attribute desired.
86 87 88 |
# File 'lib/protocol/http2/window_update_frame.rb', line 86 def desired @desired end |
Instance Method Details
#limited? ⇒ Boolean
97 98 99 100 101 102 103 |
# File 'lib/protocol/http2/window_update_frame.rb', line 97 def limited? if @desired @available < @desired else super end end |
#wanted ⇒ Object
88 89 90 91 92 93 94 95 |
# File 'lib/protocol/http2/window_update_frame.rb', line 88 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 |