module Async::HTTP::Protocol::HTTP2::Connection
def read_in_background(parent: Task.current)
def read_in_background(parent: Task.current) raise RuntimeError, "Connection is closed!" if closed? parent.async(transient: true) do |task| @reader = task task.annotate("#{version} reading data for #{self.class}.") begin while !self.closed? self.consume_window self.read_frame end rescue SocketError, IOError, EOFError, Errno::ECONNRESET, Errno::EPIPE, Async::Wrapper::Cancelled # Ignore. rescue ::Protocol::HTTP2::GoawayError => error # Error is raised if a response is actively reading from the # connection. The connection is silently closed if GOAWAY is # received outside the request/response cycle. if @reader self.close(error) end ensure # Don't call #close twice. if @reader self.close($!) end end end end