Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions reassembler.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func (l *eventList) remove() {
}

// Clear removes all events from the list and returns the events and the number
// of list events.
// of lost events.
func (l *eventList) Clear() ([]*event, int) {
l.Lock()
defer l.Unlock()
Expand All @@ -243,7 +243,7 @@ func (l *eventList) Clear() ([]*event, int) {
event := l.events[seq]

if l.lastSeq > 0 {
lost += int(seq - l.lastSeq - 1)
lost += int(seq) - int(l.lastSeq) - 1
}
l.lastSeq = seq
evicted = append(evicted, event)
Expand Down Expand Up @@ -302,7 +302,7 @@ func (l *eventList) CleanUp() ([]*event, int) {

if event.complete || size > l.maxSize || event.IsExpired() {
if l.lastSeq > 0 {
lost += int(seq - l.lastSeq - 1)
lost += int(seq) - int(l.lastSeq) - 1
}
l.lastSeq = seq
evicted = append(evicted, event)
Expand Down