Ignore really old packets. (#2891)

* Ignore really old packets.

There are cases where really old packets (time stamp is way back, but
sequence number looks like it is moving forward) which cause the
sequence number to update incorrectly. Drop those packets are they are
very old.

* test
This commit is contained in:
Raja Subramanian
2024-07-29 10:51:01 +05:30
committed by GitHub
parent d27ecc0732
commit 3e6e6e2732
3 changed files with 42 additions and 1 deletions
+8
View File
@@ -111,6 +111,14 @@ func (w *WrapAround[T, ET]) Update(val T) (result WrapAroundUpdateResult[ET]) {
return
}
func (w *WrapAround[T, ET]) UndoUpdate(result WrapAroundUpdateResult[ET]) {
if !w.initialized || result.PreExtendedHighest >= result.ExtendedVal {
return
}
w.ResetHighest(result.PreExtendedHighest)
}
func (w *WrapAround[T, ET]) Rollover(val T, numCycles int) (result WrapAroundUpdateResult[ET]) {
if !w.initialized || numCycles == 0 {
return w.Update(val)