4
0
mirror of https://github.com/cwinfo/yggdrasil-map synced 2025-08-14 15:58:10 +00:00

add histogramming code, update crawler, allow longer names

This commit is contained in:
Arceliar
2021-07-31 10:34:52 -05:00
parent 17c800f4b1
commit 19cdf8de34
3 changed files with 51 additions and 1 deletions

View File

@@ -13,6 +13,13 @@ var visited sync.Map
var rumored sync.Map
const MAX_RETRY = 3
const N_PARALLEL_REQ = 32
var semaphore chan struct{}
func init() {
semaphore = make(chan struct{}, N_PARALLEL_REQ)
}
func dial() (net.Conn, error) {
return net.DialTimeout("unix", "/var/run/yggdrasil.sock", time.Second)
@@ -85,6 +92,8 @@ func doRumor(key string, out chan rumorResult) {
waitgroup.Add(1)
go func() {
defer waitgroup.Done()
semaphore<-struct{}{}
defer func() { <-semaphore }()
if _, known := rumored.LoadOrStore(key, true); known {
return
}