Fix a bug in UDS connect

This commit is contained in:
Stjepan Glavina 2020-04-28 16:08:16 +02:00
parent 0c1455f5fa
commit 3b867877e9
1 changed files with 9 additions and 1 deletions

View File

@ -860,7 +860,15 @@ impl Async<UnixStream> {
// Begin async connect and ignore the inevitable "not yet connected" error.
socket.set_nonblocking(true)?;
let _ = socket.connect(&socket2::SockAddr::unix(path)?);
socket
.connect(&socket2::SockAddr::unix(path)?)
.or_else(|err| {
if err.kind() == io::ErrorKind::NotConnected {
Ok(())
} else {
Err(err)
}
})?;
let stream = Async::new(socket.into_unix_stream())?;
// Wait for connect to complete.