This commit is contained in:
crusader 2018-09-28 15:20:03 +09:00
parent 1077e59831
commit 94609b4366

View File

@ -83,7 +83,7 @@ type ofDiscoverySession struct {
discoveredMtx sync.RWMutex
hosts map[string]*omd.Host
includeMachosts map[string]*omd.Host
includeMacHosts map[string]*omd.Host
ports map[*omd.Host]map[json.Number]map[string]*omd.Port
services map[*omd.Port]map[string]*omd.Service
privileged bool
@ -106,7 +106,7 @@ func (ds *ofDiscoverySession) init(request types.DiscoveryRequest) {
ds.targetHostAddresses = nil
ds.targetPortNumbers = nil
ds.hosts = make(map[string]*omd.Host)
ds.includeMachosts = make(map[string]*omd.Host)
ds.includeMacHosts = make(map[string]*omd.Host)
ds.ports = make(map[*omd.Host]map[json.Number]map[string]*omd.Port)
ds.services = make(map[*omd.Port]map[string]*omd.Service)
@ -453,7 +453,7 @@ func (ds *ofDiscoverySession) DiscoveredHost(address string) *omd.Host {
func (ds *ofDiscoverySession) DiscoveredAllHosts(includeMac bool) map[string]*omd.Host {
if includeMac {
return ds.includeMachosts
return ds.includeMacHosts
}
return ds.hosts
}
@ -582,7 +582,7 @@ func (ds *ofDiscoverySession) findHost(host *omd.Host) (h *omd.Host, modified bo
if !ok {
ds.hosts[host.Address] = host
if "" != host.Mac {
ds.includeMachosts[host.Address] = host
ds.includeMacHosts[host.Address] = host
}
h = host
modified = true
@ -1028,7 +1028,7 @@ func ReleaseDiscoverySession(ds *ofDiscoverySession) {
ds.discoveryDelegator = nil
ds.includeMachosts = nil
ds.includeMacHosts = nil
ds.hosts = nil
ds.ports = nil
ds.services = nil