More functional get_all_self_addrs()

This commit is contained in:
Hocuri
2022-04-22 15:52:38 +02:00
committed by holger krekel
parent d29c09caf3
commit a4f5d2b9b2

View File

@@ -381,12 +381,10 @@ impl Context {
/// Returns all primary and secondary self addresses. /// Returns all primary and secondary self addresses.
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> { pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> {
let mut ret = Vec::new(); let primary_addrs = self.get_primary_self_addr().await.into_iter();
let secondary_addrs = self.get_secondary_self_addrs().await?.into_iter();
ret.extend(self.get_primary_self_addr().await.into_iter()); Ok(primary_addrs.chain(secondary_addrs).collect())
ret.extend(self.get_secondary_self_addrs().await?.into_iter());
Ok(ret)
} }
/// Returns all secondary self addresses. /// Returns all secondary self addresses.