ing
This commit is contained in:
parent
7535e7ffc1
commit
dee29f34d9
|
@ -98,14 +98,17 @@ func (d *ofDiscoverer) enqueue(req *ofDiscoveryRequest) {
|
|||
go func() {
|
||||
select {
|
||||
case <-req.dequeue:
|
||||
case <-time.After(10 * time.Second):
|
||||
case <-time.After(20 * time.Second):
|
||||
req.timeout = true
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeTimeout, omu.Now(), nil)
|
||||
req.release()
|
||||
}
|
||||
}()
|
||||
default:
|
||||
d.SendMessage(req, types.DiscoveryMessageTypeFailedQueueing, omu.Now(), nil)
|
||||
select {
|
||||
case <-time.After(time.Microsecond * 500):
|
||||
}
|
||||
|
||||
req.release()
|
||||
}
|
||||
}
|
||||
|
@ -123,6 +126,7 @@ LOOP:
|
|||
return
|
||||
}
|
||||
if req.(*ofDiscoveryRequest).timeout {
|
||||
req.(*ofDiscoveryRequest).release()
|
||||
continue LOOP
|
||||
}
|
||||
req.(*ofDiscoveryRequest).dequeue <- true
|
||||
|
@ -136,12 +140,12 @@ LOOP:
|
|||
|
||||
session.ReleaseDiscoverySession(s)
|
||||
|
||||
timer := time.NewTimer(time.Millisecond * 500)
|
||||
select {
|
||||
case <-timer.C:
|
||||
}
|
||||
req.(*ofDiscoveryRequest).release()
|
||||
|
||||
select {
|
||||
case <-time.After(time.Second * 1):
|
||||
}
|
||||
|
||||
log.Print("Discovery Session complete")
|
||||
case <-d.stopChan:
|
||||
return
|
||||
|
|
|
@ -103,10 +103,8 @@ func sendARP(ps pcap.PCapScanner, zone *omd.Zone, targetHosts []net.IP) error {
|
|||
return err
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -105,10 +105,8 @@ LOOP:
|
|||
continue LOOP
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -104,10 +104,8 @@ LOOP:
|
|||
continue LOOP
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,10 +56,8 @@ Loop:
|
|||
tryConnect(discoverySession, ports, targetHost, port, timeout, stopChan)
|
||||
}(portNumber)
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
case <-discoverySession.StopChan():
|
||||
close(stopChan)
|
||||
return nil
|
||||
|
|
|
@ -109,10 +109,8 @@ Loop:
|
|||
return err
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
case <-stopChan:
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -56,10 +56,8 @@ Loop:
|
|||
tryConnect(discoverySession, ports, targetHost, port, timeout, stopChan)
|
||||
}(portNumber)
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
case <-discoverySession.StopChan():
|
||||
close(stopChan)
|
||||
return nil
|
||||
|
|
|
@ -116,10 +116,8 @@ func sendUDP4(discoverySession session.DiscoverySession, ps pcap.PCapScanner, ho
|
|||
}
|
||||
}
|
||||
|
||||
timer := time.NewTimer(time.Microsecond * 100)
|
||||
|
||||
select {
|
||||
case <-timer.C:
|
||||
case <-time.After(time.Microsecond * 100):
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user