class Async::HTTP::Protocol::HTTP2::Server
def create_stream(stream_id)
def create_stream(stream_id) request = Request.new(self, stream_id) return request.stream end
def each
def each while request = @requests.dequeue @count += 1 # We need to close the stream if the user code blows up while generating a response: response = begin response = yield(request) rescue request.stream.send_reset_stream(::HTTP::Protocol::HTTP2::INTERNAL_ERROR) Async.logger.error(request) {$!} else request.send_response(response) end end end
def initialize(stream)
def initialize(stream) @stream = stream framer = ::HTTP::Protocol::HTTP2::Framer.new(stream) super(framer) @requests = Async::Queue.new end
def stop_connection
def stop_connection super @requests.enqueue nil end