lib/httpx/connection/http2.rb in httpx-1.3.0 vs lib/httpx/connection/http2.rb in httpx-1.3.1

- old
+ new

@@ -121,22 +121,26 @@ handle(request, stream) end end - def handle_error(ex) + def handle_error(ex, request = nil) if ex.instance_of?(TimeoutError) && !@handshake_completed && @connection.state != :closed @connection.goaway(:settings_timeout, "closing due to settings timeout") emit(:close_handshake) settings_ex = SettingsTimeoutError.new(ex.timeout, ex.message) settings_ex.set_backtrace(ex.backtrace) ex = settings_ex end - @streams.each_key do |request| - emit(:error, request, ex) + @streams.each_key do |req| + next if request && request == req + + emit(:error, req, ex) end - @pending.each do |request| - emit(:error, request, ex) + @pending.each do |req| + next if request && request == req + + emit(:error, req, ex) end end def ping ping = SecureRandom.gen_random(8)