浏览代码

Optimized cluster scanning algorithm during initialization

TC pushbot 5 2 年之前
父节点
当前提交
6957fa5c03
共有 2 个文件被更改,包括 7 次插入3 次删除
  1. 1 2
      mod/network/mdns/mdns.go
  2. 6 1
      mod/network/neighbour/neighbour.go

+ 1 - 2
mod/network/mdns/mdns.go

@@ -121,7 +121,6 @@ func (m *MDNSHost) Scan(timeout int, domainFilter string) []*NetworkHost {
 	go func(results <-chan *zeroconf.ServiceEntry) {
 		for entry := range results {
 			if domainFilter == "" {
-
 				//This is a ArOZ Online Host
 				//Split the required information out of the text element
 				TEXT := entry.Text
@@ -159,7 +158,7 @@ func (m *MDNSHost) Scan(timeout int, domainFilter string) []*NetworkHost {
 
 			} else {
 				if stringInSlice("domain="+domainFilter, entry.Text) {
-					//This is a ArOZ Online Host
+					//This is generic scan request
 					//Split the required information out of the text element
 					TEXT := entry.Text
 					properties := map[string]string{}

+ 6 - 1
mod/network/neighbour/neighbour.go

@@ -86,10 +86,15 @@ func (d *Discoverer) StartScanning(interval int, scanDuration int) {
 		}
 	}()
 
+	go func() {
+		//Run initial scanning
+		d.UpdateScan(scanDuration)
+		log.Println("ArozOS Neighbour Scanning Completed, ", len(d.NearbyHosts), " neighbours found!")
+	}()
+
 	//Update the Discoverer settings
 	d.d = done
 	d.t = ticker
-	log.Println("ArozOS Neighbour Scanning Completed, ", len(d.NearbyHosts), " neighbours found!")
 }
 
 func (d *Discoverer) UpdateScan(scanDuration int) {