-
Notifications
You must be signed in to change notification settings - Fork 68
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
feat : add the ability to identify if tcp connection has failed #185
Conversation
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.
There should be a function on Poller
indicating whether or not is_connect_failed
is supported, like with edge triggered polling.
src/kqueue.rs
Outdated
|
||
#[inline] | ||
pub fn is_connect_failed(&self) -> bool { | ||
unimplemented!("is connect failed is not supported on kqueue"); |
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.
Just return false
here, no need to panic
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.
updated
examples/tcp_client.rs
Outdated
let Some(event) = event else { | ||
println!("no event"); | ||
return Ok(()); | ||
}; |
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.
Is this syntax compatible with Rust 1.63?
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.
updated
/// | ||
/// This indicates a tcp connection has failed, it corresponds to the `EPOLLERR` along with `EPOLLHUP` event in linux | ||
/// and `CONNECT_FAILED` event in windows IOCP. | ||
/// |
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.
This should have an example.
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.
added
src/poll.rs
Outdated
// need reviewer's special attention, as I do not have access to a system that supports this | ||
// this is a guess based on the documentation of `poll()` | ||
self.flags.contains(PollFlags::ERR) || self.flags.contains(PollFlags::HUP) |
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.
This looks right to me
Actually, I think it might be a saner model to have it return |
You mean for is_connect_failed? do we still need supports_is_connect_failed in this case? |
Yes, that's right. No we do not. |
808428d
to
3144404
Compare
updated! |
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.
Thanks!
Added is_connection_failed method to identify if a tcp connection has failed, please see example
tcp_client.rs
.Let me know if adding socket2 to dev-dependency is acceptable, I will remove it if not.
address #184