mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
Fix on concurrent access to the Stations map by UpdateStats method
This commit is contained in:
parent
69248094c4
commit
420ab9e26c
2 changed files with 12 additions and 3 deletions
|
@ -70,6 +70,15 @@ func (w *WiFi) AddIfNew(ssid, mac string, isAp bool, channel int, rssi int8) *St
|
|||
return nil
|
||||
}
|
||||
|
||||
func (w *WiFi) Get(mac string) (*Station, bool) {
|
||||
w.Lock()
|
||||
defer w.Unlock()
|
||||
|
||||
mac = NormalizeMac(mac)
|
||||
station, found := w.Stations[mac]
|
||||
return station, found
|
||||
}
|
||||
|
||||
func (w *WiFi) Clear() error {
|
||||
w.Stations = make(map[string]*Station)
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue