fix: a lost packet reserves the samples it owed instead of vanishing from the timeline

This commit is contained in:
Martino Ferrari committed 2026-10-08 18:18:12 +02:00
1 parent 85ba835d61
commit 5915fc8421
4 files changed
+183 -9

No files matched your search

+19 -1
View File
@@ -654,7 +654,25 @@ void ScopeModel::set_display_epoch(f64 e) noexcept {
}
void ScopeModel::acquire_all() {
if (store_) store_->acquire_all();
if (store_) {
store_->acquire_all();
// Drop holes whose slots the time ring has already overwritten: their slot addresses
// would alias live slots once the ring wraps past them, and they can no longer be
// backfilled or drawn. `base()` is the absolute index of the oldest slot the ring
// still retains -- anything earlier has already been discarded.
forget_holes_before(store_->time().base());
}
}
void ScopeModel::note_hole(const Hole& h) {
if (holes_.size() >= kMaxHoles) holes_.erase(holes_.begin());
holes_.push_back(h);
}
void ScopeModel::forget_holes_before(u64 slot) {
// A hole whose last slot the ring has dropped can no longer be backfilled or drawn, and
// its address would alias a live slot once the ring wraps past it.
std::erase_if(holes_, [slot](const Hole& h) { return h.slot_begin + h.slot_count <= slot; });
}
void ScopeModel::set_trigger_enabled(bool on) {