Skip to content
This repository was archived by the owner on Nov 27, 2018. It is now read-only.

Commit dbacaa0

Browse files
committed
Be tolerant to a few errors from ipfix parser
1 parent 5a3c3ec commit dbacaa0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

main.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,20 @@ type myInterpretedField struct {
2828
func messagesGenerator(s *ipfix.Session) <-chan []InterpretedRecord {
2929
c := make(chan []InterpretedRecord)
3030

31+
errors := 0
3132
go func() {
3233
for {
3334
msg, err := s.ReadMessage()
3435
if err != nil {
35-
panic(err)
36+
errors++
37+
if errors > 3 {
38+
panic(err)
39+
} else {
40+
log.Println(err)
41+
}
42+
continue
43+
} else {
44+
errors = 0
3645
}
3746

3847
irecs := make([]InterpretedRecord, len(msg.DataRecords))

0 commit comments

Comments
 (0)