autorelay: refactor relay finder and start autorelay after identify (#2120)

* Refactor relay_finder and start autorelay after identify

* Clock fork

* Remove multiple timers and use a single rate limiting chan for findNodes

* Remove clock fork

* Rename

* Use scheduledWork.nextAllowedCallToPeerSource.Add(rf.conf.minInterval)

* Fix flaky test that relied on time
This commit is contained in:
Marco Munizaga
2023-02-22 21:51:59 -08:00
committed by GitHub
parent 640632419e
commit b74205d265
6 changed files with 215 additions and 169 deletions

View File

@@ -433,7 +433,9 @@ func (cfg *Config) NewNode() (host.Host, error) {
ho = routed.Wrap(h, router)
}
if ar != nil {
return autorelay.NewAutoRelayHost(ho, ar), nil
arh := autorelay.NewAutoRelayHost(ho, ar)
arh.Start()
ho = arh
}
return ho, nil
}