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

Add start and await bootstrap #295

Open
05nelsonm opened this issue Mar 24, 2023 · 2 comments
Open

Add start and await bootstrap #295

05nelsonm opened this issue Mar 24, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@05nelsonm
Copy link
Owner

Currently, TorManager.start starts the tor daemon and then returns success or failure (before Tor bootstraps); it only starts the tor daemon, nothing more. After tor bootstraps, AddressInfo is then dispatched as an event to its attached listeners.

This is a bit of a UX pain point for library consumers, as they need to add listeners and put all that logic there for instantiating and tearing down Http clients.

Tor has 2 phases to it's startup process:

  1. Starting the tor daemon
  2. Bootstrapping

Bootstrapping phase is unpredictable as it is dependent on many outside factors (internet being down, tor network consensus being slow, not finding enough network peers, etc.). As such, TorManager.start simply *cannot await for bootstrapping to complete as it would inhibit other calls in the queue from being executed (such as stop or restart) which should interrupt the bootstrap phase.

As I do not want to increase the current API surface area, I figure something in the samples will suffice for the time being.

Extension function should:

  • Check TorManager's current state and currently set AddressInfo and, if available, return it as the result
  • If not, it should register a listener before calling start and suspend until the registered listener catches the AddressInfo or tor is shutdown.
@05nelsonm 05nelsonm added the enhancement New feature or request label Mar 24, 2023
@05nelsonm
Copy link
Owner Author

This should be a part of 2.0.0's API.

@05nelsonm 05nelsonm added this to the 2.0.0-alpha01 milestone Dec 26, 2023
@05nelsonm 05nelsonm changed the title Add start and await bootstrap example to sample apps Add start and await bootstrap Dec 26, 2023
@05nelsonm
Copy link
Owner Author

Sadly, will not make it into 2.0.0-alpha01. Another day 😞

@05nelsonm 05nelsonm removed this from the 2.0.0-alpha01 milestone Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant