mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-08-10 00:01:27 -04:00
allow parsers to define a connection timeout, and channge it via callback
This commit is contained in:
parent
b569cc9984
commit
5cfb494d50
@ -434,6 +434,9 @@ module HTTPX
|
||||
transition(:open)
|
||||
end
|
||||
end
|
||||
parser.on(:current_timeout) do
|
||||
@current_timeout = @timeout = parser.timeout
|
||||
end
|
||||
parser.on(:timeout) do |tout|
|
||||
@timeout = tout
|
||||
end
|
||||
@ -464,7 +467,7 @@ module HTTPX
|
||||
|
||||
send_pending
|
||||
|
||||
@timeout = @current_timeout = @options.timeout[:operation_timeout]
|
||||
@timeout = @current_timeout = parser.timeout
|
||||
emit(:open)
|
||||
when :closing
|
||||
return unless @state == :open
|
||||
|
@ -24,6 +24,10 @@ module HTTPX
|
||||
@handshake_completed = false
|
||||
end
|
||||
|
||||
def timeout
|
||||
@options.timeout[:operation_timeout]
|
||||
end
|
||||
|
||||
def interests
|
||||
# this means we're processing incoming response already
|
||||
return :r if @request
|
||||
|
@ -34,6 +34,10 @@ module HTTPX
|
||||
init_connection
|
||||
end
|
||||
|
||||
def timeout
|
||||
@options.timeout[:settings_timeout]
|
||||
end
|
||||
|
||||
def interests
|
||||
# waiting for WINDOW_UPDATE frames
|
||||
return :r if @buffer.full?
|
||||
@ -312,6 +316,7 @@ module HTTPX
|
||||
|
||||
def on_settings(*)
|
||||
@handshake_completed = true
|
||||
emit(:current_timeout)
|
||||
|
||||
if @max_requests.zero?
|
||||
@max_requests = @connection.remote_settings[:settings_max_concurrent_streams]
|
||||
|
@ -85,6 +85,10 @@ module HTTPX
|
||||
@options = Options.new(options)
|
||||
end
|
||||
|
||||
def timeout
|
||||
@options.timeout[:operation_timeout]
|
||||
end
|
||||
|
||||
def close; end
|
||||
|
||||
def consume(*); end
|
||||
|
@ -133,6 +133,10 @@ module HTTPX
|
||||
@options = Options.new(options)
|
||||
end
|
||||
|
||||
def timeout
|
||||
@options.timeout[:operation_timeout]
|
||||
end
|
||||
|
||||
def close; end
|
||||
|
||||
def consume(*); end
|
||||
|
@ -42,6 +42,8 @@ module HTTPX
|
||||
|
||||
def ping: () -> void
|
||||
|
||||
def timeout: () -> Integer
|
||||
|
||||
private
|
||||
|
||||
def initialize: (Buffer, options) -> untyped
|
||||
|
@ -35,6 +35,8 @@ module HTTPX
|
||||
|
||||
alias reset init_connection
|
||||
|
||||
def timeout: () -> Integer
|
||||
|
||||
private
|
||||
|
||||
def initialize: (Buffer, options) -> untyped
|
||||
|
@ -14,6 +14,7 @@ module HTTPX
|
||||
class SocksParser
|
||||
include Callbacks
|
||||
|
||||
def timeout: () -> Integer
|
||||
def close: () -> void
|
||||
def consume: (*untyped) -> void
|
||||
def empty: () -> bool
|
||||
|
@ -15,6 +15,7 @@ module HTTPX
|
||||
class SocksParser
|
||||
include Callbacks
|
||||
|
||||
def timeout: () -> Integer
|
||||
def close: () -> void
|
||||
def consume: (*untyped) -> void
|
||||
def empty: () -> bool
|
||||
|
Loading…
x
Reference in New Issue
Block a user