moved on connection close to separate method, which will address all connection logic

This commit is contained in:
HoneyryderChuck 2018-08-29 14:46:38 +01:00
parent 6c890bfa12
commit 083dd5ae6d

View File

@ -129,9 +129,7 @@ module HTTPX
reset
send(@pending.shift) unless @pending.empty?
return unless response.headers["connection"] == "close"
disable_concurrency
emit(:reset)
manage_connection(response)
end
def handle_error(ex)
@ -142,6 +140,15 @@ module HTTPX
private
def manage_connection(response)
connection = response.headers["connection"]
case connection
when /close/i, nil
disable_pipelining
emit(:reset)
end
end
def disable_concurrency
return if @requests.empty?
@requests.each { |r| r.transition(:idle) }