fix: a hole straddling the counter wrap now matches its late packets

The lookup compared raw uint32 counters with >= and <, so a hole spanning the
2^32 wrap matched nothing and every late packet belonging to it was dropped. A
signed delta, the idiom deps/udpsclient already uses throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-10-09 06:52:24 +02:00
1 parent 51d13a09cb
commit d2d4b7f204
1 file changed
+5 -1
+5 -1
View File
@@ -900,9 +900,13 @@ void Acquisition::backfill_from(const udps_frame_t* frame, const Partition& part
// and resequencing are one design. A stamp could not answer it -- the packet's own stamps // and resequencing are one design. A stamp could not answer it -- the packet's own stamps
// are a claim about a timeline the ring has moved past -- but the counter indexes the // are a claim about a timeline the ring has moved past -- but the counter indexes the
// reservation table directly. // reservation table directly.
// By signed delta, the idiom the client uses throughout: the counter is a wrapping uint32, so
// a raw `>=`/`<` pair matches nothing for a hole straddling the 2^32 wrap and every one of its
// late packets would be dropped on the next line.
Hole* hole = nullptr; Hole* hole = nullptr;
for (Hole& h : model_.holes()) { for (Hole& h : model_.holes()) {
if (frame->counter >= h.counter_first && frame->counter < h.counter_first + h.packets) { const std::int32_t into = static_cast<std::int32_t>(frame->counter - h.counter_first);
if (into >= 0 && into < static_cast<std::int32_t>(h.packets)) {
hole = &h; hole = &h;
break; break;
} }