Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect_ssl uses connect_timeout (Closes #359) #362

Merged
merged 2 commits into from
Aug 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions lib/http/timeout/null.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,19 @@ def write(data)
private

# Retry reading
def rescue_readable
def rescue_readable(timeout = read_timeout)
yield
rescue IO::WaitReadable
retry if @socket.to_io.wait_readable(read_timeout)
raise TimeoutError, "Read timed out after #{read_timeout} seconds"
retry if @socket.to_io.wait_readable(timeout)
raise TimeoutError, "Read timed out after #{timeout} seconds"
end

# Retry writing
def rescue_writable
def rescue_writable(timeout = write_timeout)
yield
rescue IO::WaitWritable
retry if @socket.to_io.wait_writable(write_timeout)
raise TimeoutError, "Write timed out after #{write_timeout} seconds"
retry if @socket.to_io.wait_writable(timeout)
raise TimeoutError, "Write timed out after #{timeout} seconds"
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/http/timeout/per_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def connect(socket_class, host, port, nodelay = false)
end

def connect_ssl
rescue_readable do
rescue_writable do
rescue_readable(@connect_timeout) do
rescue_writable(@connect_timeout) do
@socket.connect_nonblock
end
end
Expand Down