This commit is contained in:
crusader 2018-09-05 05:03:43 +09:00
parent 4e18a6f932
commit b9ac5b2a71
9 changed files with 9 additions and 18 deletions

View File

@ -52,9 +52,7 @@ func Scan(discoverySession session.DiscoverySession) error {
}
delay.Store(true)
if h := handlePacketARP(zone, targetHosts, hosts, packet); nil != h {
if h != nil {
discoverySession.AddHost(h)
}
go discoverySession.AddHost(h)
}
case <-ticker.C:
if false == delay.Load().(bool) {

View File

@ -54,9 +54,7 @@ func scanV4(discoverySession session.DiscoverySession) error {
}
delay.Store(true)
if h := handlePacketICMP4(zone, targetHosts, hosts, packet); nil != h {
if h != nil {
discoverySession.AddHost(h)
}
go discoverySession.AddHost(h)
}
case <-ticker.C:
if false == delay.Load().(bool) {

View File

@ -49,16 +49,11 @@ func scanV6(discoverySession session.DiscoverySession) error {
select {
case packet, ok := <-icmpChan:
if !ok {
// logging.Logger().Debugf("icmp channel is closed")
return
}
delay.Store(true)
if h := handlePacketICMP6(zone, targetHosts, hosts, packet); nil != h {
if h != nil {
discoverySession.AddHost(h)
}
// resultChan <- h
go discoverySession.AddHost(h)
}
case <-ticker.C:
if false == delay.Load().(bool) {

View File

@ -102,7 +102,7 @@ func tryConnect(discoverySession session.DiscoverySession, ports map[int]*omd.Po
ports[port] = p
discoverySession.AddPort(p)
go discoverySession.AddPort(p)
}
func Ulimit() int64 {

View File

@ -47,7 +47,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
}
delay.Store(true)
if p := handlePacketTCP4(discoverySession, targetHost, ports, packet); nil != p {
discoverySession.AddPort(p)
go discoverySession.AddPort(p)
}
case <-ticker.C:
if false == delay.Load().(bool) {

View File

@ -102,7 +102,7 @@ func tryConnect(discoverySession session.DiscoverySession, ports map[int]*omd.Po
ports[port] = p
discoverySession.AddPort(p)
go discoverySession.AddPort(p)
}
func Ulimit() int64 {

View File

@ -47,7 +47,7 @@ func scanV4(discoverySession session.DiscoverySession, targetHost *omd.Host) err
}
delay.Store(true)
if p := handlePacketUDP4(discoverySession, targetHost, ports, packet); nil != p {
discoverySession.AddPort(p)
go discoverySession.AddPort(p)
}
case <-ticker.C:
if false == delay.Load().(bool) {

View File

@ -78,7 +78,7 @@ LOOP:
if nil != discoveredMatcher {
// log.Printf("discovered matcher: %s(%s) %v", discoveredMatcher.Name(), discoveredMatcher.Key(), discoveredMatcher)
discoverySession.AddService(&omd.Service{
go discoverySession.AddService(&omd.Service{
MetaCryptoType: discoveredConnector.metaCryptoType(),
Key: discoveredMatcher.Key(),
Name: discoveredMatcher.Name(matchCtx),

View File

@ -34,7 +34,7 @@ func scanUDP(discoverySession session.DiscoverySession, targetPort *omd.Port) er
Name: _matcher.Name(matchCtx),
}
discoverySession.AddService(s)
go discoverySession.AddService(s)
return nil
}