mirror of
https://github.com/bettercap/bettercap.git
synced 2025-03-12 04:36:03 -07:00
Kepp sync.WorkerGroup.Add() outside of goroutine
The workergroup should be added before starting the worker. The worker routine itself should not start the worker. It causes race condition.
This commit is contained in:
parent
1fee1f718d
commit
050bd28511
modules
@ -227,8 +227,8 @@ func (mod *SynScanner) synScan() error {
|
||||
mod.State.Store("progress", 0.0)
|
||||
|
||||
// start the collector
|
||||
mod.waitGroup.Add(1)
|
||||
go func() {
|
||||
mod.waitGroup.Add(1)
|
||||
defer mod.waitGroup.Done()
|
||||
|
||||
for packet := range mod.packets {
|
||||
|
@ -88,9 +88,8 @@ func (mod *WiFiModule) startAssoc(to net.HardwareAddr) error {
|
||||
}
|
||||
return fmt.Errorf("%s is an unknown BSSID or it is in the association skip list.", to.String())
|
||||
}
|
||||
|
||||
mod.writes.Add(1)
|
||||
go func() {
|
||||
mod.writes.Add(1)
|
||||
defer mod.writes.Done()
|
||||
|
||||
// since we need to change the wifi adapter channel for each
|
||||
|
@ -113,8 +113,8 @@ func (mod *WiFiModule) startDeauth(to net.HardwareAddr) error {
|
||||
return fmt.Errorf("%s is an unknown BSSID, is in the deauth skip list, or doesn't have detected clients.", to.String())
|
||||
}
|
||||
|
||||
mod.writes.Add(1)
|
||||
go func() {
|
||||
mod.writes.Add(1)
|
||||
defer mod.writes.Done()
|
||||
|
||||
// since we need to change the wifi adapter channel for each
|
||||
|
Loading…
x
Reference in New Issue
Block a user