module Async::HTTP::Protocol::HTTP2::Connection

def read_in_background(task: Task.current)

def read_in_background(task: Task.current)
	task.async do |nested_task|
		nested_task.annotate("#{version} reading data for #{self.class}")
		
		begin
			while !self.closed?
				self.consume_window
				self.read_frame
			end
		rescue EOFError, Errno::ECONNRESET, Errno::EPIPE, Async::Wrapper::Cancelled
			# Ignore.
		ensure
			close($!)
		end
	end
end