Use plain get_config(Config::ConfiguredAddr) to not ignore db errors

This commit is contained in:
Hocuri
2022-04-24 12:39:46 +02:00
committed by holger krekel
parent 0e595c9801
commit 9e1770316a
3 changed files with 13 additions and 6 deletions

View File

@@ -338,8 +338,8 @@ impl Context {
/// determine whether the specified addr maps to the/a self addr
pub(crate) async fn is_self_addr(&self, addr: &str) -> Result<bool> {
Ok(self
.get_primary_self_addr()
.await
.get_config(Config::ConfiguredAddr)
.await?
.iter()
.any(|a| addr_cmp(addr, a))
|| self
@@ -372,7 +372,7 @@ impl Context {
/// Returns all primary and secondary self addresses.
pub(crate) async fn get_all_self_addrs(&self) -> Result<Vec<String>> {
let primary_addrs = self.get_primary_self_addr().await.into_iter();
let primary_addrs = self.get_config(Config::ConfiguredAddr).await?.into_iter();
let secondary_addrs = self.get_secondary_self_addrs().await?.into_iter();
Ok(primary_addrs.chain(secondary_addrs).collect())
@@ -391,6 +391,7 @@ impl Context {
}
/// Returns the primary self address.
/// Returns an error if no self addr is configured.
pub async fn get_primary_self_addr(&self) -> Result<String> {
self.get_config(Config::ConfiguredAddr)
.await?