fix(client): keep ping-less family unknown after route returns
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M
This commit is contained in:
@@ -165,7 +165,9 @@ class Connectivity:
|
|||||||
key = (addr, gw)
|
key = (addr, gw)
|
||||||
st.addr, st.gateway = addr, gw
|
st.addr, st.gateway = addr, gw
|
||||||
self._last_key[fam] = key
|
self._last_key[fam] = key
|
||||||
if due and fam not in self._ping_disabled:
|
if fam in self._ping_disabled:
|
||||||
|
st.present = None # cannot probe: unknown, never absent, while a route exists
|
||||||
|
elif due:
|
||||||
await self._tier2(fam, st, now)
|
await self._tier2(fam, st, now)
|
||||||
|
|
||||||
async def _tier2(self, fam: str, st: FamilyState, now: float) -> None:
|
async def _tier2(self, fam: str, st: FamilyState, now: float) -> None:
|
||||||
|
|||||||
@@ -156,3 +156,18 @@ def test_from_config():
|
|||||||
assert c.probes["ipv4"] == "9.9.9.9"
|
assert c.probes["ipv4"] == "9.9.9.9"
|
||||||
assert c.probes["ipv6"] == "2606:4700:4700::1111"
|
assert c.probes["ipv6"] == "2606:4700:4700::1111"
|
||||||
assert c.probe_interval == 30.0
|
assert c.probe_interval == 30.0
|
||||||
|
|
||||||
|
|
||||||
|
def test_ping_less_family_stays_unknown_after_route_returns():
|
||||||
|
net = Net()
|
||||||
|
net.rtt["ipv4"] = "unavailable"
|
||||||
|
c = make(net)
|
||||||
|
refresh(c)
|
||||||
|
assert "p4" not in c.flags()
|
||||||
|
net.addr["ipv4"] = None
|
||||||
|
refresh(c)
|
||||||
|
assert c.flags()["p4"] is False # no route is definitive
|
||||||
|
net.addr["ipv4"] = "192.0.2.5"
|
||||||
|
refresh(c)
|
||||||
|
assert "p4" not in c.flags()
|
||||||
|
assert net.pings.count("ipv4") == 1 # missing binary is not retried
|
||||||
|
|||||||
Reference in New Issue
Block a user