fix(reflectors): tolerate individual DNS resolution failures
Log and skip unresolved reflectors so startup can proceed with usable endpoints. Report an error when none remain for the selected protocol.
This commit is contained in:
1 parent
78bcb7886a
commit
a073a9d049
1 file changed
+11
-1
+11
-1
@@ -174,7 +174,14 @@ fn resolve_reflectors(
|
|||||||
} else {
|
} else {
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
for endpoint in (definition.host.as_str(), port).to_socket_addrs()? {
|
let endpoints = match (definition.host.as_str(), port).to_socket_addrs() {
|
||||||
|
Ok(endpoints) => endpoints,
|
||||||
|
Err(error) => {
|
||||||
|
warn!("Failed to resolve reflector {}: {error}", definition.host);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for endpoint in endpoints {
|
||||||
if protocol != ReflectorProtocol::Irtt && endpoint.is_ipv6() {
|
if protocol != ReflectorProtocol::Irtt && endpoint.is_ipv6() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -199,6 +206,9 @@ fn setup_reflectors(settings: &Settings) -> anyhow::Result<ReflectorSetup> {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|(endpoint, definition)| (*endpoint, definition.clone())),
|
.map(|(endpoint, definition)| (*endpoint, definition.clone())),
|
||||||
);
|
);
|
||||||
|
if reflectors.is_empty() {
|
||||||
|
anyhow::bail!("no usable reflectors for measurement protocol {protocol}");
|
||||||
|
}
|
||||||
let mut pool = configured.keys().copied().collect::<Vec<_>>();
|
let mut pool = configured.keys().copied().collect::<Vec<_>>();
|
||||||
pool.sort();
|
pool.sort();
|
||||||
let mut initial = bootstrap.keys().copied().collect::<Vec<_>>();
|
let mut initial = bootstrap.keys().copied().collect::<Vec<_>>();
|
||||||
|
|||||||
Reference in new issue
Block a user