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

def close

def close
	Async.logger.debug(self) {"Closing connection"}
	
	@reader.stop if @reader
	@stream.close
end

def connected?

Can we use this connection to make requests?
def connected?
	@stream.connected?
end

def initialize(*)

def initialize(*)
	super
	
	@count = 0
	@reader = nil
end

def multiplex

def multiplex
	@remote_settings.maximum_concurrent_streams
end

def peer

def peer
	@stream.io
end

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")
		
		begin
			# Even thought the connection might be logically closed, we are not done until all HTTP/2 streams are closed or the underlying I/O is closed.
			while !@stream.closed?
				self.read_frame
			end
		rescue
			Async.logger.debug(self) {$!}
		ensure
			stop_connection
		end
	end
end

def reusable?

def reusable?
	!(self.closed? || @stream.closed?)
end

def start_connection

def start_connection
	@reader ||= read_in_background
end

def stop_connection

def stop_connection
	@reader = nil
end

def version

def version
	VERSION
end