Skip to content

Commit 9c0350c

Browse files
committed
ignore WouldBlock error
1 parent 39d4110 commit 9c0350c

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

crates/nfs3_client/src/smol.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,16 @@ impl Connector for SmolConnector {
6666
let socket = socket2::Socket::new(domain, ty, Some(socket2::Protocol::TCP))?;
6767
socket.set_nonblocking(true)?;
6868
socket.bind(&local_addr.into())?;
69-
socket.connect(&remote_addr.into())?;
69+
if let Err(err) = socket.connect(&remote_addr.into()) {
70+
#[cfg(unix)]
71+
if err.raw_os_error() != Some(libc::EINPROGRESS) {
72+
return Err(err);
73+
}
74+
#[cfg(windows)]
75+
if err.kind() != std::io::ErrorKind::WouldBlock {
76+
return Err(err);
77+
}
78+
}
7079

7180
let std_stream: std::net::TcpStream = socket.into();
7281
let tcp_stream = TcpStream::try_from(std_stream)?;

0 commit comments

Comments
 (0)