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

proposal to expand (a subset of) linux specific socket capabilities. #129121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion library/std/src/os/android/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
pub use crate::os::net::linux_ext::addr::SocketAddrExt;
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub use crate::os::net::linux_ext::socket::UnixSocketExt;
#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
pub use crate::os::net::linux_ext::tcp::TcpStreamExt;
2 changes: 1 addition & 1 deletion library/std/src/os/linux/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
pub use crate::os::net::linux_ext::addr::SocketAddrExt;
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub use crate::os::net::linux_ext::socket::UnixSocketExt;
#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
pub use crate::os::net::linux_ext::tcp::TcpStreamExt;
2 changes: 1 addition & 1 deletion library/std/src/os/net/linux_ext/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub(crate) mod addr;
#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
pub(crate) mod socket;

#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
pub(crate) mod tcp;

#[cfg(test)]
Expand Down
12 changes: 5 additions & 7 deletions library/std/src/os/net/linux_ext/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{io, net};
/// Os-specific extensions for [`TcpStream`]
///
/// [`TcpStream`]: net::TcpStream
#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
pub trait TcpStreamExt: Sealed {
/// Enable or disable `TCP_QUICKACK`.
///
Expand All @@ -23,15 +23,14 @@ pub trait TcpStreamExt: Sealed {
/// # Examples
///
/// ```no_run
/// #![feature(tcp_quickack)]
/// use std::net::TcpStream;
/// use std::os::linux::net::TcpStreamExt;
///
/// let stream = TcpStream::connect("127.0.0.1:8080")
/// .expect("Couldn't connect to the server...");
/// stream.set_quickack(true).expect("set_quickack call failed");
/// ```
#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
fn set_quickack(&self, quickack: bool) -> io::Result<()>;

/// Gets the value of the `TCP_QUICKACK` option on this socket.
Expand All @@ -41,7 +40,6 @@ pub trait TcpStreamExt: Sealed {
/// # Examples
///
/// ```no_run
/// #![feature(tcp_quickack)]
/// use std::net::TcpStream;
/// use std::os::linux::net::TcpStreamExt;
///
Expand All @@ -50,7 +48,7 @@ pub trait TcpStreamExt: Sealed {
/// stream.set_quickack(true).expect("set_quickack call failed");
/// assert_eq!(stream.quickack().unwrap_or(false), true);
/// ```
#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
fn quickack(&self) -> io::Result<bool>;

/// A socket listener will be awakened solely when data arrives.
Expand Down Expand Up @@ -99,10 +97,10 @@ pub trait TcpStreamExt: Sealed {
fn deferaccept(&self) -> io::Result<u32>;
}

#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
impl Sealed for net::TcpStream {}

#[unstable(feature = "tcp_quickack", issue = "96256")]
#[stable(feature = "tcp_quickack", since = "CURRENT_RUSTC_VERSION")]
impl TcpStreamExt for net::TcpStream {
fn set_quickack(&self, quickack: bool) -> io::Result<()> {
self.as_inner().as_inner().set_quickack(quickack)
Expand Down
Loading