Reopen the census socket when the tether reconnects #156
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "census-tether-socket"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this PR does
Makes the census plugin open a fresh socket when the phone's Bluetooth tether drops and comes back. A tether that reconnects is a new
bnep0interface under the same name, and the census can sleep through the reconnect between its cycles._census_dht.UdpTransportrecords the interface (name and index) it bound to, reads the binding back after opening (acan't bind to bnep0health note if it doesn't take), and checks before every send that the socket is still bound to that same interface. If it isn't, the send raisesLinkDownand sends nothing, so the census pauses briefly and reopens, as it already does when the tether drops mid-cycle.census._linkchecks the socket at the start of each cycle and opens a fresh one when the tether has reconnected since the last cycle, loggingcensus: the tether reconnected; opening a fresh socket.losends; one whose binding is gone, or whose interface was replaced under the same name, sends nothing; the worker opens a fresh socket and carries on writing after a reconnect between cycles, with nothing more sent on the old one. The new tests fail without the change.docs/user-guide/census-setup.md: a troubleshooting row forpaused: the network link went down.Checklist
make lint(ansible--syntax-check,yamllint,shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.make test(thekestrel_pipytest suite and the real-data check's tests). The Test workflow runs this on the PR.192.0.2.x,127.0.0.1, the fake DHT).docs/user-guide/census-setup.md.GUIDE_MDhas no census troubleshooting table, so it's unchanged.Release impact
plugins/census.pyand its helperplugins/_census_dht.py, plus tests and docs.Notes for review
🤖 Generated with Claude Code