aboutsummaryrefslogtreecommitdiff
path: root/src/util/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/config.rs')
-rw-r--r--src/util/config.rs27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/util/config.rs b/src/util/config.rs
index 6b449459..9ff67711 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -90,14 +90,21 @@ where
{
use std::net::ToSocketAddrs;
- let mut res = vec![];
- for s in <Vec<&str>>::deserialize(deserializer)? {
- res.push(
- s.to_socket_addrs()
- .map_err(|_| de::Error::custom("could not resolve to a socket address"))?
- .next()
- .ok_or(de::Error::custom("could not resolve to a socket address"))?,
- );
- }
- Ok(res)
+ Ok(<Vec<&str>>::deserialize(deserializer)?
+ .iter()
+ .filter_map(|&name| {
+ name.to_socket_addrs()
+ .map(|iter| (name, iter))
+ .map_err(|_| warn!("Error resolving \"{}\"", name))
+ .ok()
+ })
+ .map(|(name, iter)| {
+ let v = iter.collect::<Vec<_>>();
+ if v.is_empty() {
+ warn!("Error resolving \"{}\"", name)
+ }
+ v
+ })
+ .flatten()
+ .collect())
}