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.



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

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

Instance Method Details

#readObject



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

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