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
Add connect_timeout #1
Conversation
Untested on Windows as I don't have access to a Windows box for a couple days. |
ab7443c
to
aa17f4b
Compare
src/sys/unix/mod.rs
Outdated
|
||
let timeout = cmp::min(timeout, c_int::max_value() as u64) as c_int; | ||
|
||
let r = unsafe { libc::poll(&mut pollfd, 1, timeout) }; |
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 think this'll want to loop to handle EINTR
, right? (or at least that'd what I'd expect a "convenient" implementation to do
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.
What should we do about the timeout in that situation? Just use the original one, or try to keep it updated with a couple of Instants?
Doesn't everything use SA_RESTART, anyway?
src/sys/unix/mod.rs
Outdated
} | ||
} | ||
|
||
self.set_nonblocking(false) |
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.
Perhaps this could be lifted above the match r
to unconditionally happen?
Updated |
Unlike the rest of the API, connect_timeout does not correspond to a single API call. However, it's a fundamental operation, and is a pain to set up.
👍 |
Unlike the rest of the API, connect_timeout does not correspond to a
single API call. However, it's a fundamental operation, and is a pain to
set up.