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