lib/async/http/protocol/http1/connection.rb in async-http-0.76.0 vs lib/async/http/protocol/http1/connection.rb in async-http-0.77.0
- old
+ new
@@ -1,29 +1,28 @@
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2018-2024, by Samuel Williams.
-require 'protocol/http1'
+require "protocol/http1"
-require_relative 'request'
-require_relative 'response'
+require_relative "request"
+require_relative "response"
module Async
module HTTP
module Protocol
module HTTP1
class Connection < ::Protocol::HTTP1::Connection
def initialize(stream, version)
super(stream)
- @ready = true
@version = version
end
def to_s
- "\#<#{self.class} negotiated #{@version}, currently #{@ready ? 'ready' : 'in-use'}>"
+ "\#<#{self.class} negotiated #{@version}, #{@state}>"
end
def as_json(...)
to_s
end
@@ -60,14 +59,14 @@
1
end
# Can we use this connection to make requests?
def viable?
- @ready && @stream&.readable?
+ self.idle? && @stream&.readable?
end
def reusable?
- @ready && @persistent && @stream && !@stream.closed?
+ @persistent && @stream && !@stream.closed?
end
end
end
end
end