Stream forever with eviction-based per-stream loss detection

This commit is contained in:
flamingcow
2026-07-25 18:33:36 -07:00
parent 2516d908b9
commit 7c09c34564
4 changed files with 117 additions and 151 deletions
+2 -15
View File
@@ -18,19 +18,13 @@ type rxStats struct {
_ [24]byte
}
type streamState struct {
maxSeq atomic.Uint64
count atomic.Uint64
_ [48]byte
}
type rxWorker struct {
fd int
batch int
cpu int
spec *frameSpec
stats *rxStats
streams []streamState
streams []lossWindow
reports chan string
ready *sync.WaitGroup
}
@@ -68,14 +62,7 @@ func (w *rxWorker) run(done *atomic.Bool) {
w.stats.bytes.Add(uint64(len(buf)))
if int(p.stream) < len(w.streams) {
st := &w.streams[p.stream]
st.count.Add(1)
for {
old := st.maxSeq.Load()
if p.seq <= old || st.maxSeq.CompareAndSwap(old, p.seq) {
break
}
}
w.streams[p.stream].observe(p.seq)
}
if p.payLen > len(w.spec.ref) {