lib/httpx/connection/http2.rb in httpx-1.1.5 vs lib/httpx/connection/http2.rb in httpx-1.2.0
- old
+ new
@@ -53,11 +53,11 @@
return unless @handshake_completed
return :w
end
- unless (@connection.state == :connected && @handshake_completed)
+ unless @connection.state == :connected && @handshake_completed
return @buffer.empty? ? :r : :rw
end
return :w if !@pending.empty? && can_buffer_more_requests?
@@ -71,12 +71,15 @@
:rw
end
def close
- @connection.goaway unless @connection.state == :closed
- emit(:close)
+ unless @connection.state == :closed
+ @connection.goaway
+ emit(:timeout, @options.timeout[:close_handshake_timeout])
+ end
+ emit(:close, true)
end
def empty?
@connection.state == :closed || @streams.empty?
end
@@ -145,9 +148,10 @@
private
def send_pending
while (request = @pending.shift)
+ # TODO: this request should go back to top of stack
break unless send(request)
end
end
def handle(request, stream)