Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed May 28, 2020
1 parent 47f093e commit ff3a1d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
23 changes: 10 additions & 13 deletions heim-net/src/sys/unix/nic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ impl Nic {
}

pub async fn nic() -> Result<impl Stream<Item = Result<Nic>>> {
let iter = ifaddrs::getifaddrs()?
.filter_map(|addr| {
if addr.address.is_some() {
Some(Ok(Nic(addr)))
} else {
None
}
});
let iter = ifaddrs::getifaddrs()?.filter_map(|addr| {
if addr.address.is_some() {
Some(Ok(Nic(addr)))
} else {
None
}
});

Ok(stream::iter(iter))
}
Expand All @@ -80,11 +79,9 @@ impl From<&socket::SockAddr> for Address {
use nix::sys::socket::SockAddr::*;

match *s {
Inet(addr) => {
match addr.to_std() {
SocketAddr::V4(addr) => Address::Inet(addr),
SocketAddr::V6(addr) => Address::Inet6(addr),
}
Inet(addr) => match addr.to_std() {
SocketAddr::V4(addr) => Address::Inet(addr),
SocketAddr::V6(addr) => Address::Inet6(addr),
},
Link(addr) => Address::Link(MacAddr::from(addr.addr())),
other => unimplemented!("Unknown sockaddr: {:?}", other),
Expand Down
4 changes: 2 additions & 2 deletions heim-net/src/sys/windows/nic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Nic {
}
}

pub fn nic() -> impl Stream<Item = Result<Nic>> {
pub async fn nic() -> Result<impl Stream<Item = Result<Nic>>> {
// TODO: Stub
stream::iter(vec![])
Ok(stream::empty())
}

0 comments on commit ff3a1d8

Please sign in to comment.