mirror of
https://github.com/freemkv/freemkv-keysources.git
synced 2026-10-07 18:13:11 +00:00
3cdf0201ae48d5cd4f268473eea37db10d2061dd
Round 1 separated a config fault from a transient one and then routed them to OPPOSITE severities. `GuardFail::Config` returned `Ok(Vec::new())` from `query` while `GuardFail::Unreachable` returned `Err`, so a mistyped port — `https://host:notaport/` — produced one `warn!` and a benign-looking empty, which `MultiSource::first_non_empty` cannot distinguish from "no source has a row for this disc". The disc was reported as E7022 "no key for this disc". That is the seven-hour-502 collapse with the polarity reversed, and worse: an outage self-heals, a typo in a config file does not. Every way of failing to ASK is now `Err(KeyServiceUnavailable)`, logged at error level with text that names it as a URL to fix rather than an outage to wait out. That covers the address-guard rejection (bad port, malformed URL, a host resolving to a non-public address) and the cleartext `http://` refusal, which had the same silent shape. The two input-shaped guards — an over-cap MKB, too few content samples — deliberately stay `Ok(empty)`: they are properties of this disc, not faults, and calling them an outage would mislabel them in the other direction. The line between the three cases is now written down at the guards themselves. Not a rip-breaking change: an `Err` never blocks the chain, because `first_non_empty` still returns any later source's key set outright and surfaces a failure only when nothing anywhere resolved. Also: the agent-reuse cache key is now sorted and deduped. It was an ordered `Vec<SocketAddr>` compare, so a round-robin keyserver — the one deployment the connection reuse exists for — reordered its A/AAAA records and missed the cache on every query, silently paying a fresh TLS handshake each time. Set equality is also the honest predicate for "the same validated addresses". Note for libfreemkv: there is no `KeyServiceMisconfigured` code, so a permanent fault borrows the transient E7028. E7028's "the source never answered" is exactly right here; only its "retry later" hint is wrong.
Languages
Rust
100%