lib/httpx/io/tcp.rb in httpx-0.24.3 vs lib/httpx/io/tcp.rb in httpx-0.24.4

- old
+ new

@@ -190,9 +190,20 @@ def closed? @state == :idle || @state == :closed end + def expired? + # do not mess with external sockets + return false if @options.io + + return true unless @addresses + + resolver_addresses = Resolver.nolookup_resolve(@hostname) + + (Array(resolver_addresses) & @addresses).empty? + end + # :nocov: def inspect "#<#{self.class}: #{@ip}:#{@port} (state: #{@state})>" end # :nocov: