diff --git a/tokio/src/net/tcp/socket.rs b/tokio/src/net/tcp/socket.rs index 171e2401899..bc93e83020f 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -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> { + self.inner.take_error() + } + /// Binds the socket to the given address. /// /// This calls the `bind(2)` operating-system function. Behavior is diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index 5228e1bc242..204d9ca256c 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -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> { + self.io.take_error() + } + /// Returns the remote address that this stream is connected to. /// /// # Examples