Repository navigation
fix: shorten the duplicate packet window to 800 ms - #1930
Conversation
Responders that jitter their repeated announcements a little under a second apart had the second copy dropped as a duplicate.
PR Review — fix: shorten the duplicate packet window to 800 msMerge-ready: the change is small and does what the description says, with one comment nit. Strengths:
Needs attention:
Accepted trade-offs:
Not verified: the shell for this review blocked Python, so I did not run the tests. The test and bench results in the description are the author's claims. Checklist
Automated review by Kōan (Claude) |
halibsbot
left a comment
There was a problem hiding this comment.
Tip
No blocking issues found — ready to merge.
|
Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, and may keep LGPL-2.1-or-later as an OR option so GPL-2.0-only projects can keep using the library, see #1835. By continuing with this pull request you agree that this new contribution is offered under both Apache 2.0 and LGPL-2.1-or-later, so it is covered under either outcome. This notice does not affect your previous contributions. If you would like to consent to relicensing those as well, please post the consent statement on #1835; silence is never treated as consent for past work. If offering this contribution under these licenses does not work for you, no hard feelings; reply with the exact phrase |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1930 +/- ##
=======================================
Coverage 99.87% 99.87%
=======================================
Files 33 33
Lines 3913 3913
Branches 568 568
=======================================
Hits 3908 3908
Misses 3 3
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will not alter performance1 warning
Comparing |
|
Fixed the stale "~1s" wording in |
Summary
Lowers the duplicate packet window from 1000 ms to 800 ms so the second copy of a repeated announcement is no longer thrown away when it lands just under a second after the first.
RFC 6762 §8.3 has responders repeat announcements about a second apart. lwIP's responder (used by the LibreTiny boards ESPHome supports) jitters that to 926 to 1028 ms on receipt, so roughly a quarter of the time the second announcement was dropped as a duplicate before any listener saw it.
Details
_DUPLICATE_QUESTION_INTERVALstays at 999 ms. The two constants were never actually linked. The question interval started as_BROWSER_TIME - 1in Implement duplicate question supression #770, when the browser's first requery was 1000 ms. The packet window became 1000 ms in Limit duplicate packet suppression to 1s intervals #841 to match the RFC 6762 §6 rule that a responder must not multicast a record more than once a second. When feat: significantly improve efficiency of the ServiceBrowser scheduler #1335 raised_BROWSER_TIMEto 10 s, 999 became a literal and picked up the "1ms less" comment, but nothing depends on it. The question interval also spaces our own QM requeries, which RFC 6762 wants at least a second apart, so it should stay where it is.QueryHandlerchecks that separately and sends recently multicast records throughout_delay_queue.Test plan
tests/test_listener.py: a repeat 5 ms later is dropped, a repeat 926 ms later is processed.