From e5c0d40caf422486dabafefe1e9ac0be88fbd9fa Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Fri, 18 Nov 2022 17:34:13 +0100 Subject: [PATCH] net: fix named pipe connect --- tokio/src/net/windows/named_pipe.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tokio/src/net/windows/named_pipe.rs b/tokio/src/net/windows/named_pipe.rs index c895dabacc8..c5515dccf72 100644 --- a/tokio/src/net/windows/named_pipe.rs +++ b/tokio/src/net/windows/named_pipe.rs @@ -192,17 +192,7 @@ impl NamedPipeServer { /// # Ok(()) } /// ``` pub async fn connect(&self) -> io::Result<()> { - loop { - match self.io.connect() { - Ok(()) => break, - Err(e) if e.kind() == io::ErrorKind::WouldBlock => { - self.io.registration().readiness(Interest::WRITABLE).await?; - } - Err(e) => return Err(e), - } - } - - Ok(()) + self.io.registration().async_io(Interest::WRITABLE, || self.io.connect()).await } /// Disconnects the server end of a named pipe instance from a client