Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autorelay: Handle WithMinInterval(0) without constantly looping #2189

Closed
sukunrt opened this issue Mar 16, 2023 · 0 comments · Fixed by #2208
Closed

autorelay: Handle WithMinInterval(0) without constantly looping #2189

sukunrt opened this issue Mar 16, 2023 · 0 comments · Fixed by #2208
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@sukunrt
Copy link
Member

sukunrt commented Mar 16, 2023

If we initialise autorelay with WithMinInterval(0) that causes the background go routine to go into a spin loop.
https://github.com/libp2p/go-libp2p/blob/master/p2p/host/autorelay/relay_finder.go#L225-L230
here the scheduledTime for next allowed call will always be current time and the scheduledWorkTimer fires immediately.

kubo currently uses MinInterval(0)
https://github.com/ipfs/kubo/blob/a3366c522a578db610d8633c5a15ebddb6e96e39/core/node/libp2p/relay.go#L101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
1 participant