Module: Plum::FlowControl
- Included in:
- Connection, Stream
- Defined in:
- lib/plum/flow_control.rb
Instance Attribute Summary collapse
-
#recv_remaining_window ⇒ Object
readonly
Returns the value of attribute recv_remaining_window.
-
#send_remaining_window ⇒ Object
readonly
Returns the value of attribute send_remaining_window.
Instance Method Summary collapse
-
#send(frame) ⇒ Object
Sends frame respecting inner-stream flow control.
-
#window_update(wsi) ⇒ Object
Increases receiving window size.
Instance Attribute Details
#recv_remaining_window ⇒ Object (readonly)
Returns the value of attribute recv_remaining_window.
5 6 7 |
# File 'lib/plum/flow_control.rb', line 5 def recv_remaining_window @recv_remaining_window end |
#send_remaining_window ⇒ Object (readonly)
Returns the value of attribute send_remaining_window.
5 6 7 |
# File 'lib/plum/flow_control.rb', line 5 def send_remaining_window @send_remaining_window end |
Instance Method Details
#send(frame) ⇒ Object
Sends frame respecting inner-stream flow control.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/plum/flow_control.rb', line 9 def send(frame) if frame.type == :data @send_buffer << frame if @send_remaining_window < frame.length if Stream === self connection.callback(:send_deferred, self, frame) else callback(:send_deferred, self, frame) end else consume_send_buffer end else send_immediately frame end end |
#window_update(wsi) ⇒ Object
Increases receiving window size. Sends WINDOW_UPDATE frame to the peer.
28 29 30 31 32 33 |
# File 'lib/plum/flow_control.rb', line 28 def window_update(wsi) @recv_remaining_window += wsi payload = "".push_uint32(wsi) sid = (Stream === self) ? self.id : 0 send_immediately Frame.new(type: :window_update, stream_id: sid, payload: payload) end |