Skip to content

Commit

Permalink
wifi.go: dont claim read lock until it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
bonedaddy committed Dec 23, 2020
1 parent 08cad80 commit 10817d5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions network/wifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ func (w *WiFi) NumHandshakes() int {
}

func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error {
w.RLock()
defer w.RUnlock()

// check if folder exists first
dirName := filepath.Dir(fileName)
if _, err := os.Stat(dirName); err != nil {
Expand All @@ -244,6 +241,9 @@ func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error
}
}

w.RLock()
defer w.RUnlock()

for _, ap := range w.aps {
for _, station := range ap.Clients() {
// if half (which includes also complete) or has pmkid
Expand Down

0 comments on commit 10817d5

Please sign in to comment.