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

Revert to IO.select for PerOperation timeouts (fixes #298) #322

Merged
merged 1 commit into from
Mar 21, 2016
Merged
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
7 changes: 3 additions & 4 deletions lib/http/timeout/per_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def connect(socket_class, host, port, nodelay = false)
def connect_ssl
rescue_readable do
rescue_writable do
socket.connect_nonblock
@socket.connect_nonblock
end
end
end
Expand Down Expand Up @@ -66,7 +66,7 @@ def readpartial(size)
return result
end

unless @socket.to_io.wait_readable(read_timeout)
unless IO.select([@socket], nil, nil, read_timeout)
fail TimeoutError, "Read timed out after #{read_timeout} seconds"
end
end
Expand All @@ -78,13 +78,12 @@ def write(data)
result = @socket.write_nonblock(data, :exception => false)
return result unless result == :wait_writable

unless @socket.to_io.wait_writable(write_timeout)
unless IO.select(nil, [@socket], nil, write_timeout)
fail TimeoutError, "Write timed out after #{write_timeout} seconds"
end
end
end
end
# rubocop:enable Metrics/BlockNesting
end
end
end