Handle Pcap EOF
This commit is contained in:
parent
a59d7f7584
commit
ce7b360dff
1 changed files with 6 additions and 2 deletions
8
main.go
8
main.go
|
@ -20,6 +20,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"flag"
|
||||
"io"
|
||||
"log"
|
||||
"math/rand/v2"
|
||||
"net"
|
||||
|
@ -166,9 +167,12 @@ func main() {
|
|||
if errors.Is(err, pcap.NextErrorTimeoutExpired) {
|
||||
continue
|
||||
}
|
||||
|
||||
if errors.Is(err, io.EOF) || errors.Is(err, pcap.NextErrorNoMorePackets) {
|
||||
return
|
||||
}
|
||||
if err != nil {
|
||||
log.Fatalf("Couldn't read AppleTalk / AARP packet data: %v", err)
|
||||
log.Printf("Couldn't read AppleTalk / AARP packet data: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
ethFrame := new(ethertalk.Packet)
|
||||
|
|
Loading…
Reference in a new issue