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

net: Add take_error to TcpSocket and TcpStream #4739

Merged
merged 2 commits into from Jun 3, 2022
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
5 changes: 5 additions & 0 deletions tokio/src/net/tcp/socket.rs
Expand Up @@ -424,6 +424,11 @@ impl TcpSocket {
self.inner.local_addr().and_then(convert_address)
}

/// Returns the value of the `SO_ERROR` option.
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
self.inner.take_error()
}

/// Binds the socket to the given address.
///
/// This calls the `bind(2)` operating-system function. Behavior is
Expand Down
5 changes: 5 additions & 0 deletions tokio/src/net/tcp/stream.rs
Expand Up @@ -264,6 +264,11 @@ impl TcpStream {
self.io.local_addr()
}

/// Returns the value of the `SO_ERROR` option.
pub fn take_error(&self) -> io::Result<Option<io::Error>> {
self.io.take_error()
}

/// Returns the remote address that this stream is connected to.
///
/// # Examples
Expand Down