fix: gracefully handling wifi device disconnection

This commit is contained in:
evilsocket 2019-03-30 16:17:26 +01:00
commit afe300cd8a
No known key found for this signature in database
GPG key ID: 1564D7F30393A456
4 changed files with 53 additions and 22 deletions

View file

@ -561,6 +561,17 @@ func (mod *WiFiModule) Start() error {
return nil
}
func (mod *WiFiModule) forcedStop() error {
return mod.SetRunning(false, func() {
// signal the main for loop we want to exit
if !mod.pktSourceChanClosed {
mod.pktSourceChan <- nil
}
// close the pcap handle to make the main for exit
mod.handle.Close()
})
}
func (mod *WiFiModule) Stop() error {
return mod.SetRunning(false, func() {
// wait any pending write operation