ing
This commit is contained in:
@@ -25,15 +25,11 @@ func Scan(discoverySession session.DiscoverySession) error {
|
||||
|
||||
zone := discoverySession.Zone()
|
||||
|
||||
ps, err := pcap.RetainScanner(zone)
|
||||
if nil != err {
|
||||
return fmt.Errorf("Cannot retain pcap instance %v", err)
|
||||
ps := discoverySession.PCapScanner()
|
||||
if nil == ps {
|
||||
return fmt.Errorf("Cannot retain pcap instance")
|
||||
}
|
||||
|
||||
defer func() {
|
||||
pcap.ReleaseScanner(zone)
|
||||
}()
|
||||
|
||||
arpChan := ps.OpenARP()
|
||||
defer func() {
|
||||
ps.CloseARP(arpChan)
|
||||
@@ -57,16 +53,13 @@ func Scan(discoverySession session.DiscoverySession) error {
|
||||
delay.Store(true)
|
||||
if h := handlePacketARP(zone, targetHosts, hosts, packet); nil != h {
|
||||
if h != nil {
|
||||
// log.Print("Host ", h)
|
||||
discoverySession.AddHost(h)
|
||||
}
|
||||
|
||||
// resultChan <- h
|
||||
}
|
||||
case <-ticker.C:
|
||||
if false == delay.Load().(bool) {
|
||||
ticker.Stop()
|
||||
timerStopped <- struct{}{}
|
||||
close(timerStopped)
|
||||
return
|
||||
}
|
||||
delay.Store(false)
|
||||
|
||||
Reference in New Issue
Block a user