call #consume in a specific close_handshake instead

This commit is contained in:
HoneyryderChuck 2021-05-30 02:14:32 +01:00
parent 1907a00d19
commit a49fcc65f5
2 changed files with 6 additions and 1 deletions

View File

@ -422,6 +422,9 @@ module HTTPX
emit(:close)
end
end
parser.on(:close_handshake) do
consume
end
parser.on(:reset) do
if parser.empty?
reset
@ -471,6 +474,7 @@ module HTTPX
emit(:open)
when :closing
return unless @state == :open
when :closed
return unless @state == :closing
return unless @write_buffer.empty?

View File

@ -123,8 +123,9 @@ module HTTPX
end
def handle_error(ex)
if ex.instance_of?(TimeoutError) && !@handshake_completed
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