-
Notifications
You must be signed in to change notification settings - Fork 321
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
Use Timeout.timeout for TCP connection #195
Conversation
…ng timeouts in pure Ruby
@httprb/owners fyi if someone can 👍 quickly |
else fail ArgumentError, "unsupported address class: #{addr.class}" | ||
def connect_ssl | ||
socket.connect_nonblock | ||
rescue IO::WaitReadable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I missed this on the last pass, but as the SSL/TLS handshake makes many roundtrips, I believe it's possible for IO::WaitWritable to be raised here too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops I broke Excon then!!
Sent from my iPhone
On Mar 31, 2015, at 08:40, Tony Arcieri notifications@github.com wrote:
In lib/http/timeout/per_operation.rb:
case addr
when Resolv::IPv4
family = Socket::AF_INET
when Resolv::IPv6
family = Socket::AF_INET6
else fail ArgumentError, "unsupported address class: #{addr.class}"
def connect_ssl
socket.connect_nonblock
I guess I missed this on the last pass, but as the SSL/TLS handshake makes many roundtrips, I believe it's possible for IO::WaitWritable to be raised here too.rescue IO::WaitReadable
—
Reply to this email directly or view it on GitHub.
This looks fine to me |
👍 from me as well :D |
Use Timeout.timeout for TCP connection
Unfortunately, getting a pure solution to timeouts is essentially impossible without rewriting the entire stack yourself. Which I might actually do for fun later, but for the time being. This is the simplest way of getting a connect timeout :(