mirror of https://github.com/stjepang/smol
Fix a bug in UDS connect
This commit is contained in:
parent
0c1455f5fa
commit
3b867877e9
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue