Investigate ^C behaviour
This commit is contained in:
parent
2c4eb80595
commit
a59d7f7584
1 changed files with 9 additions and 0 deletions
9
main.go
9
main.go
|
@ -31,6 +31,7 @@ import (
|
||||||
|
|
||||||
"gitea.drjosh.dev/josh/jrouter/atalk"
|
"gitea.drjosh.dev/josh/jrouter/atalk"
|
||||||
"gitea.drjosh.dev/josh/jrouter/aurp"
|
"gitea.drjosh.dev/josh/jrouter/aurp"
|
||||||
|
"github.com/google/gopacket/pcap"
|
||||||
"github.com/sfiera/multitalk/pkg/ddp"
|
"github.com/sfiera/multitalk/pkg/ddp"
|
||||||
"github.com/sfiera/multitalk/pkg/ethernet"
|
"github.com/sfiera/multitalk/pkg/ethernet"
|
||||||
"github.com/sfiera/multitalk/pkg/ethertalk"
|
"github.com/sfiera/multitalk/pkg/ethertalk"
|
||||||
|
@ -157,7 +158,15 @@ func main() {
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
|
if ctx.Err() != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
rawPkt, _, err := pcapHandle.ReadPacketData()
|
rawPkt, _, err := pcapHandle.ReadPacketData()
|
||||||
|
if errors.Is(err, pcap.NextErrorTimeoutExpired) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Couldn't read AppleTalk / AARP packet data: %v", err)
|
log.Fatalf("Couldn't read AppleTalk / AARP packet data: %v", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue