mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: gracefully handling wifi device disconnection
This commit is contained in:
parent
54116f7fbe
commit
afe300cd8a
4 changed files with 53 additions and 22 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue