Class: Async::HTTP::Protocol::HTTP2::Stream::Input

Inherits:
Body::Writable
  • Object
show all
Defined in:
lib/async/http/protocol/http2/stream.rb

Overview

A writable body which requests window updates when data is read from it.

Instance Method Summary collapse

Methods inherited from Body::Writable

#close, #closed?, #empty?, #inspect, #length, #write

Constructor Details

#initialize(stream, length) ⇒ Input

Returns a new instance of Input.



31
32
33
34
35
# File 'lib/async/http/protocol/http2/stream.rb', line 31

def initialize(stream, length)
  super(length)
  
  @stream = stream
end

Instance Method Details

#readObject



37
38
39
40
41
42
43
44
# File 'lib/async/http/protocol/http2/stream.rb', line 37

def read
  if chunk = super
    # If we read a chunk fron the stream, we want to extend the window if required so more data will be provided.
    @stream.request_window_update
  end
  
  return chunk
end