This commit is contained in:
crusader 2018-09-05 04:37:56 +09:00
parent 6f6d62f409
commit 4e18a6f932
3 changed files with 4 additions and 7 deletions

View File

@ -136,14 +136,16 @@ LOOP:
d.SendMessage(req, types.DiscoveryMessageTypeStart, omu.Now(), nil)
s := session.RetainDiscoverySession()
d.discover(req, s)
select {
case <-time.After(time.Millisecond * 500):
}
d.SendMessage(req, types.DiscoveryMessageTypeStop, time.Since(startTime).String(), nil)
session.ReleaseDiscoverySession(s)
req.(*ofDiscoveryRequest).release()
select {
case <-time.After(time.Second * 1):
case <-time.After(time.Second * 2):
}
log.Print("Discovery Session complete")

View File

@ -55,11 +55,8 @@ func scanV4(discoverySession session.DiscoverySession) error {
delay.Store(true)
if h := handlePacketICMP4(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) {

View File

@ -43,13 +43,11 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
select {
case packet, ok := <-tcpChan:
if !ok {
// olog.Logger().Debug("Discovery: tcp channel is closed")
return
}
delay.Store(true)
if p := handlePacketTCP4(discoverySession, targetHost, ports, packet); nil != p {
discoverySession.AddPort(p)
log.Print(p)
}
case <-ticker.C:
if false == delay.Load().(bool) {