lib/httpx/connection/http2.rb in httpx-0.17.0 vs lib/httpx/connection/http2.rb in httpx-0.18.0

- old
+ new

@@ -289,15 +289,17 @@ log(level: 2, color: :green) { "#{stream.id}: <- #{data.inspect}" } request.response << data end def on_stream_refuse(stream, request, error) - stream.close on_stream_close(stream, request, error) + stream.close end def on_stream_close(stream, request, error) + return if error == :stream_closed && !@streams.key?(request) + log(level: 2) { "#{stream.id}: closing stream" } @drains.delete(request) @streams.delete(request) if error && error != :no_error @@ -386,13 +388,13 @@ def on_origin(origin) emit(:origin, origin) end def on_pong(ping) - if !@pings.delete(ping.to_s) - close(:protocol_error, "ping payload did not match") - else + if @pings.delete(ping.to_s) emit(:pong) + else + close(:protocol_error, "ping payload did not match") end end end Connection.register "h2", Connection::HTTP2 end