diff options
Diffstat (limited to 'internal/kobject/kobject.go')
| -rw-r--r-- | internal/kobject/kobject.go | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/internal/kobject/kobject.go b/internal/kobject/kobject.go index 2acf3de0..c4e6975b 100644 --- a/internal/kobject/kobject.go +++ b/internal/kobject/kobject.go @@ -445,11 +445,11 @@ func (s *State) processEvent(e *Event) { } // BadSequenceError is reported for an unexpected SEQNUM. -type BadSequenceError struct{ Got, Want uint64 } +type BadSequenceError struct{ Got, Cur uint64 } func (e BadSequenceError) Error() string { return "SEQNUM=" + strconv.FormatUint(e.Got, 10) + - ", want " + strconv.FormatUint(e.Want, 10) + ", current " + strconv.FormatUint(e.Cur, 10) } // Consume receives uevent messages and updates s to reflect state of kernel. @@ -478,13 +478,10 @@ func (s *State) Consume(ctx context.Context, events <-chan *uevent.Message) { continue } - if s.seq == 0 { - s.seq = e.Sequence + if s.seq > e.Sequence { + s.reportErr(BadSequenceError{e.Sequence, s.seq - 1}) } - if s.seq != e.Sequence { - s.reportErr(BadSequenceError{e.Sequence, s.seq}) - } - s.seq++ + s.seq = e.Sequence + 1 s.processEvent(&e) } } |
