Skip to content

Commit

Permalink
remove redundant loop
Browse files Browse the repository at this point in the history
  • Loading branch information
satakuma committed Nov 18, 2022
1 parent dbdad85 commit 75017ce
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions tokio/src/net/windows/named_pipe.rs
Expand Up @@ -192,21 +192,15 @@ 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 => {
return self
.io
.registration()
.async_io(Interest::WRITABLE, || self.io.connect())
.await
}
Err(e) => return Err(e),
match self.io.connect() {
Err(e) if e.kind() == io::ErrorKind::WouldBlock => {
self.io
.registration()
.async_io(Interest::WRITABLE, || self.io.connect())
.await
}
x => x,
}

Ok(())
}

/// Disconnects the server end of a named pipe instance from a client
Expand Down

0 comments on commit 75017ce

Please sign in to comment.