Skip to content

Commit

Permalink
Prevents blocking when waiting for idle timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
robgonnella committed Jul 15, 2024
1 parent 6a50156 commit 0fce8c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions pkg/scanner/arpscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ func (s *ArpScanner) Scan() error {
})
}

time.Sleep(s.idleTimeout)
time.AfterFunc(s.idleTimeout, func() {
go s.Stop()

go s.Stop()

go func() {
s.resultChan <- &ScanResult{
Type: ARPDone,
}
}()
go func() {
s.resultChan <- &ScanResult{
Type: ARPDone,
}
}()
})

return err
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/scanner/synscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,15 +156,15 @@ func (s *SynScanner) Scan() error {
}
}

time.Sleep(s.idleTimeout)
time.AfterFunc(s.idleTimeout, func() {
go s.Stop()

go s.Stop()

go func() {
s.resultChan <- &ScanResult{
Type: SYNDone,
}
}()
go func() {
s.resultChan <- &ScanResult{
Type: SYNDone,
}
}()
})

return nil
}
Expand Down

0 comments on commit 0fce8c4

Please sign in to comment.