Judge a frame against the stream its socket receives rather than the one its header claims
This commit is contained in:
@@ -65,12 +65,13 @@ func (s *rxStats) bucket(e int64) (frames, bytes uint64) {
|
||||
}
|
||||
|
||||
type rxWorker struct {
|
||||
fd int
|
||||
batch int
|
||||
spec *frameSpec
|
||||
stats *rxStats
|
||||
streams []lossWindow
|
||||
ready *sync.WaitGroup
|
||||
fd int
|
||||
batch int
|
||||
stream uint16
|
||||
spec *frameSpec
|
||||
stats *rxStats
|
||||
loss *lossWindow
|
||||
ready *sync.WaitGroup
|
||||
}
|
||||
|
||||
func (w *rxWorker) run(done *atomic.Bool) {
|
||||
@@ -115,11 +116,10 @@ func (w *rxWorker) run(done *atomic.Bool) {
|
||||
w.stats.observe(ts, uint64(len(buf)))
|
||||
}
|
||||
|
||||
// A sequence number the sender never reached got past the header
|
||||
// checksum, so the frame is damaged whatever its payload says. Counted
|
||||
// here rather than left to the payload check, which would report the
|
||||
// same frame twice or, if only the header was hit, not at all.
|
||||
if int(p.stream) < len(w.streams) && !w.streams[p.stream].observe(p.seq) {
|
||||
// The ethertype this socket is bound to already says which stream the
|
||||
// frame belongs to, so a header naming another one is damaged, as is a
|
||||
// sequence number the sender never reached.
|
||||
if p.stream != w.stream || !w.loss.observe(p.seq) {
|
||||
w.stats.badHdr.Add(1)
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user