Skip to content

Commit

Permalink
Merge pull request #28 from robgonnella/prevent-blocking-on-idle-wait
Browse files Browse the repository at this point in the history
Prevents blocking when waiting for idle timeout
  • Loading branch information
robgonnella committed Jul 15, 2024
2 parents 6a50156 + 0fce8c4 commit 21ee66d
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 21ee66d

Please sign in to comment.