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

fix: interpret circuit relay expiry as seconds #1636

Merged
merged 8 commits into from
Mar 21, 2023
Merged

Conversation

ckousik
Copy link
Contributor

@ckousik ckousik commented Mar 21, 2023

This fixes #1635 which causes the circuit relay to repeatedly connect to a discovered relay. If the relay returns connection expiration in seconds, we get a negative ttl when calculating
expiration - new Date().getTime().
This caused the addRelay function to set the timeout at 0ms. This timeout instantly triggers and calls addRelay recursively.

This fixes #1635 which causes the circuit relay to repeatedly connect
to a discovered relay. If the relay returns connection expiration in
seconds, we get a negative ttl when calculating
`expiration - new Date().getTime()`.
This caused the `addRelay` function to set the timeout at 0ms. This timeout
instantly triggers and calls `addRelay` recursively.
src/circuit/utils.ts Outdated Show resolved Hide resolved
@ckousik
Copy link
Contributor Author

ckousik commented Mar 21, 2023

@achingbrain I've bounded the timeout duration between 30 seconds and 15 minutes. The values are arbitrary for now.

@achingbrain achingbrain changed the title fix: circuitRelayTransport repeatedly connecting to relay fix: interpret circuit relay expiry as seconds Mar 21, 2023
@achingbrain achingbrain merged commit 5de0f07 into master Mar 21, 2023
@achingbrain achingbrain deleted the ckousik/fix-1635 branch March 21, 2023 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

circuitRelayTransport repeatedly reconnecting to relay
2 participants