mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
net: add take_error to TcpSocket and TcpStream (#4739)
Co-authored-by: Taiki Endo <[email protected]>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user