Stream forever with eviction-based per-stream loss detection
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user