Skip to content

Commit

Permalink
Fix bug where sniffer would not stop gracefully upon context cancella…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
orishoshan committed Oct 24, 2024
1 parent d6d71a6 commit b589ab1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sniffer/pkg/sniffer/sniffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ func (s *Sniffer) RunForever(ctx context.Context) error {

for {
select {
case <-ctx.Done():
return ctx.Err()
case packet := <-dnsPacketsChan:
s.dnsSniffer.HandlePacket(packet)
case packet := <-tcpPacketsChan:
Expand Down

0 comments on commit b589ab1

Please sign in to comment.