feat: add reconfirm_record per RFC 6762 §10.4#1772
Draft
bluetoothbot wants to merge 1 commit into
Draft
Conversation
Add Zeroconf.reconfirm_record / async_reconfirm_record and the AsyncZeroconf wrapper so callers can hint that a cached record may be stale when an application-level connect fails. Re-queries the record at t=0/1s/3s (RFC 6762 §5.2 doubling intervals) and flushes from the cache at t=10s when no fresh response lands.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1772 +/- ##
==========================================
- Coverage 99.77% 99.47% -0.31%
==========================================
Files 33 33
Lines 3536 3608 +72
Branches 498 511 +13
==========================================
+ Hits 3528 3589 +61
- Misses 5 10 +5
- Partials 3 9 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
Zeroconf.reconfirm_record/async_reconfirm_record(and theAsyncZeroconfwrapper) so callers can hint to the cache that a recordmay be stale — e.g. when an application-level connect to a discovered
service fails. Implements the cache-flush-on-failure mechanism described
in RFC 6762 §10.4.
Closes #1413
Behaviour
async_reconfirm_record(record)schedules a background task andreturns
Trueif accepted,Falseif the record is not in the cacheor a reconfirmation is already in flight (dedupes by cache entry).
the §5.2 doubling-interval pattern and "two or more queries" minimum
from §10.4.
record is force-expired and listeners (e.g.
ServiceBrowser) arenotified through the same goodbye path used for TTL-zero responses.
reconfirm_recordis the threadsafe variant for callers off theevent loop.
Constants live in
const.py(_RECONFIRM_QUERY_INTERVALS_MS,_RECONFIRM_TIMEOUT_MS) with RFC citations next to them; please do nottighten without an interop note.
Changes
Zeroconf.async_reconfirm_record/Zeroconf.reconfirm_recordin_core.pyAsyncZeroconf.async_reconfirm_recordinasyncio.pyRecordManager(_handlers/record_manager.py)plus
.pxdupdates for the newcdef public dict _reconfirm_tasksand the new
cpdefentry pointconst.pytests/test_reconfirm.py(9 tests) and aquick_reconfirm_timingfixture in
conftest.pyTest plan
pytest tests/test_reconfirm.py(9 passed)pytest tests/(404 passed, 2 skipped) — no regressionsruff check src/ tests/— clean_handlers/record_manager.pysucceeds (noclosures inside
cpdef)Quality Report
Changes: 8 files changed, 331 insertions(+), 6 deletions(-)
Code scan: clean
Tests: passed (4 PASSED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline