ing
This commit is contained in:
parent
6f6d62f409
commit
4e18a6f932
|
@ -136,14 +136,16 @@ LOOP:
|
||||||
d.SendMessage(req, types.DiscoveryMessageTypeStart, omu.Now(), nil)
|
d.SendMessage(req, types.DiscoveryMessageTypeStart, omu.Now(), nil)
|
||||||
s := session.RetainDiscoverySession()
|
s := session.RetainDiscoverySession()
|
||||||
d.discover(req, s)
|
d.discover(req, s)
|
||||||
|
select {
|
||||||
|
case <-time.After(time.Millisecond * 500):
|
||||||
|
}
|
||||||
d.SendMessage(req, types.DiscoveryMessageTypeStop, time.Since(startTime).String(), nil)
|
d.SendMessage(req, types.DiscoveryMessageTypeStop, time.Since(startTime).String(), nil)
|
||||||
|
|
||||||
session.ReleaseDiscoverySession(s)
|
session.ReleaseDiscoverySession(s)
|
||||||
|
|
||||||
req.(*ofDiscoveryRequest).release()
|
req.(*ofDiscoveryRequest).release()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(time.Second * 1):
|
case <-time.After(time.Second * 2):
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Print("Discovery Session complete")
|
log.Print("Discovery Session complete")
|
||||||
|
|
|
@ -55,11 +55,8 @@ func scanV4(discoverySession session.DiscoverySession) error {
|
||||||
delay.Store(true)
|
delay.Store(true)
|
||||||
if h := handlePacketICMP4(zone, targetHosts, hosts, packet); nil != h {
|
if h := handlePacketICMP4(zone, targetHosts, hosts, packet); nil != h {
|
||||||
if h != nil {
|
if h != nil {
|
||||||
// log.Print("Host ", h)
|
|
||||||
discoverySession.AddHost(h)
|
discoverySession.AddHost(h)
|
||||||
}
|
}
|
||||||
|
|
||||||
// resultChan <- h
|
|
||||||
}
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
if false == delay.Load().(bool) {
|
if false == delay.Load().(bool) {
|
||||||
|
|
|
@ -43,13 +43,11 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
|
||||||
select {
|
select {
|
||||||
case packet, ok := <-tcpChan:
|
case packet, ok := <-tcpChan:
|
||||||
if !ok {
|
if !ok {
|
||||||
// olog.Logger().Debug("Discovery: tcp channel is closed")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
delay.Store(true)
|
delay.Store(true)
|
||||||
if p := handlePacketTCP4(discoverySession, targetHost, ports, packet); nil != p {
|
if p := handlePacketTCP4(discoverySession, targetHost, ports, packet); nil != p {
|
||||||
discoverySession.AddPort(p)
|
discoverySession.AddPort(p)
|
||||||
log.Print(p)
|
|
||||||
}
|
}
|
||||||
case <-ticker.C:
|
case <-ticker.C:
|
||||||
if false == delay.Load().(bool) {
|
if false == delay.Load().(bool) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user