mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
fix: fixed a race condition
This commit is contained in:
parent
e5f598b274
commit
ec28d73ba7
4 changed files with 32 additions and 38 deletions
|
@ -273,17 +273,6 @@ func (w *WiFiModule) updateStats(dot11 *layers.Dot11, packet gopacket.Packet) {
|
|||
}
|
||||
}
|
||||
|
||||
func (w *WiFiModule) trackPacket(pkt gopacket.Packet) {
|
||||
pktSize := uint64(len(pkt.Data()))
|
||||
|
||||
w.Session.Queue.Stats.Lock()
|
||||
|
||||
w.Session.Queue.Stats.PktReceived++
|
||||
w.Session.Queue.Stats.Received += pktSize
|
||||
|
||||
w.Session.Queue.Stats.Unlock()
|
||||
}
|
||||
|
||||
func (w *WiFiModule) Start() error {
|
||||
if err := w.Configure(); err != nil {
|
||||
return err
|
||||
|
@ -306,13 +295,11 @@ func (w *WiFiModule) Start() error {
|
|||
for packet := range w.pktSourceChan {
|
||||
if w.Running() == false {
|
||||
break
|
||||
}
|
||||
|
||||
if packet == nil {
|
||||
} else if packet == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
w.trackPacket(packet)
|
||||
w.Session.Queue.TrackPacket(uint64(len(packet.Data())))
|
||||
|
||||
// perform initial dot11 parsing and layers validation
|
||||
if ok, radiotap, dot11 := packets.Dot11Parse(packet); ok == true {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue