From 96370ba4ce9ea5564f094354579d5539af8bbc9d Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Fri, 31 Dec 2021 19:25:50 +0900 Subject: [PATCH] net: add `TcpSocket::take_error` (#4364) --- 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 fc240e052..84c255b9b 100644 --- a/tokio/src/net/tcp/socket.rs +++ b/tokio/src/net/tcp/socket.rs @@ -409,6 +409,11 @@ impl TcpSocket { .map(|addr| addr.as_socket().unwrap()) } + /// 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