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

Document that Mio report OOB data in Event::is_readable #1524

Merged
merged 3 commits into from Nov 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Expand Up @@ -27,7 +27,7 @@ jobs:
name: nightly
displayName: Nightly
# Pin nightly to avoid being impacted by breakage
rust_version: nightly-2020-03-24
rust_version: nightly-2021-11-05
benches: true

# This represents the minimum Rust version supported by
Expand Down
9 changes: 9 additions & 0 deletions src/event/event.rs
Expand Up @@ -25,6 +25,15 @@ impl Event {
}

/// Returns true if the event contains readable readiness.
///
/// # Notes
///
/// Out-of-band (OOB) data also triggers readable events. But must
/// application don't actually read OOB data, this could leave an
/// application open to a Denial-of-Service (Dos) attack, see
/// <https://github.com/sandstorm-io/sandstorm-website/blob/58f93346028c0576e8147627667328eaaf4be9fa/_posts/2015-04-08-osx-security-bug.md>.
/// However because Mio uses edge-triggers it will not result in an infinite
/// loop as described in the article above.
pub fn is_readable(&self) -> bool {
sys::event::is_readable(&self.inner)
}
Expand Down
8 changes: 1 addition & 7 deletions src/sys/unix/uds/socketaddr.rs
Expand Up @@ -78,14 +78,8 @@ cfg_os_poll! {
/// Documentation reflected in [`SocketAddr`]
///
/// [`SocketAddr`]: std::os::unix::net::SocketAddr
// FIXME: The matches macro requires rust 1.42.0 and we still support 1.39.0
#[allow(clippy::match_like_matches_macro)]
pub fn is_unnamed(&self) -> bool {
if let AddressKind::Unnamed = self.address() {
true
} else {
false
}
matches!(self.address(), AddressKind::Unnamed)
}

/// Returns the contents of this address if it is a `pathname` address.
Expand Down