mirror of
https://github.com/OMGeeky/tarpc.git
synced 2026-01-05 19:16:29 +01:00
Don't unwrap in Listener::dialer
This commit is contained in:
@@ -34,7 +34,11 @@ impl super::Listener for UnixListener {
|
||||
self.accept().map(|(stream, _)| stream)
|
||||
}
|
||||
fn dialer(&self) -> io::Result<UnixDialer<PathBuf>> {
|
||||
self.local_addr().map(|addr| UnixDialer(addr.as_pathname().unwrap().to_owned()))
|
||||
self.local_addr().and_then(|addr| match addr.as_pathname() {
|
||||
Some(path) => Ok(UnixDialer(path.to_owned())),
|
||||
None => Err(io::Error::new(io::ErrorKind::AddrNotAvailable,
|
||||
"Couldn't get a path to bound unix socket")),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user