From b92147c7515ff5979768f5a5c3949002291bdf19 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 31 Dec 2021 14:39:31 +0900 Subject: [PATCH 1/2] net: add TcpSocket::take_error --- tokio/src/net/tcp/socket.rs | 5 +++++ 1 file changed, 5 insertions(+) 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 From c67d71e2d7ae3ca70b437e4887c07d330721f82c Mon Sep 17 00:00:00 2001 From: Max Inden Date: Fri, 3 Jun 2022 18:57:33 +0200 Subject: [PATCH 2/2] net: add TcpStream::take_error --- tokio/src/net/tcp/stream.rs | 5 +++++ 1 file changed, 5 insertions(+) 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