Skip to content

Commit

Permalink
[rhio] don’t fail if peer ip address cannot be resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ktatarnikov committed Feb 11, 2025
1 parent 329a366 commit 7f62936
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions rhio/src/node/rhio.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::net::SocketAddr;

use anyhow::{anyhow, Result};
use anyhow::{anyhow, Context, Result};
use futures_util::future::{MapErr, Shared};
use futures_util::{FutureExt, TryFutureExt};
use p2panda_core::{Hash, PrivateKey, PublicKey};
Expand All @@ -10,7 +10,7 @@ use tokio::sync::mpsc::Receiver;
use tokio::sync::{mpsc, oneshot};
use tokio::task::JoinError;
use tokio_util::task::AbortOnDropHandle;
use tracing::error;
use tracing::{error, warn};

use crate::blobs::watcher::S3Event;
use crate::blobs::Blobs;
Expand Down Expand Up @@ -93,8 +93,18 @@ impl Node {
// Resolve FQDN strings into IP addresses.
let mut direct_addresses = Vec::new();
for addr in &node.direct_addresses {
for resolved in tokio::net::lookup_host(addr).await? {
direct_addresses.push(resolved);
let maybe_peers = tokio::net::lookup_host(addr)
.await
.context(format!("Unable to lookup host {:?}, skipping", addr));
match maybe_peers {
Ok(peers) => {
for resolved in peers {
direct_addresses.push(resolved);
}
}
Err(err) => {
warn!("{:?}", err);
}
}
}
network_config
Expand Down

0 comments on commit 7f62936

Please sign in to comment.