mirror of
https://github.com/bettercap/bettercap
synced 2025-08-21 05:53:20 -07:00
fixed a panic on net.sniff due to channel being closed if reading from a pcap (fixes #246)
This commit is contained in:
parent
4cd86f3fd0
commit
7197fb1f25
1 changed files with 5 additions and 1 deletions
|
@ -163,12 +163,16 @@ func (s *Sniffer) Start() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.pktSourceChan = nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sniffer) Stop() error {
|
func (s *Sniffer) Stop() error {
|
||||||
return s.SetRunning(false, func() {
|
return s.SetRunning(false, func() {
|
||||||
|
if s.pktSourceChan != nil {
|
||||||
s.pktSourceChan <- nil
|
s.pktSourceChan <- nil
|
||||||
|
}
|
||||||
s.Ctx.Close()
|
s.Ctx.Close()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue