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"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
"net"
|
"net"
|
||||||
|
@ -166,9 +167,12 @@ func main() {
|
||||||
if errors.Is(err, pcap.NextErrorTimeoutExpired) {
|
if errors.Is(err, pcap.NextErrorTimeoutExpired) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if errors.Is(err, io.EOF) || errors.Is(err, pcap.NextErrorNoMorePackets) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if err != nil {
|
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)
|
ethFrame := new(ethertalk.Packet)
|
||||||
|
|
Loading…
Reference in a new issue