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 control port buffer so setEvents() can be called anytime #78

Open
eighthave opened this issue Apr 29, 2022 · 1 comment
Open

add control port buffer so setEvents() can be called anytime #78

eighthave opened this issue Apr 29, 2022 · 1 comment

Comments

@eighthave
Copy link
Member

I just had an idea that I think will cover this issue, be relatively easy to implement, and replace this pull request:

  • accept setEvents() calls any time
  • if the control port is not active, cache the value of last setEvents() call
  • after TorService receives the first CIRC event, send the cached setEvents() value
  • further setEvents() calls are sent directly to the control port
  • this buffer should probably be a queue that stores all recieved messages in order and replays them
  • when TorService sends STOPPING and OFF, the queue should be cleared.

This should allow setEvents() calls to work any time.

@n8fr8 @bitmold Should it queue events when it is OFF? Or only when STARTING?

@bitmold
Copy link
Contributor

bitmold commented Apr 29, 2022

Replace which pull request? I think there has been some confusion here because at one point in my troubleshooting I had conflated two bugs in tor-android with one another; in the interest of clarity:

  1. A race condition where the app using tor-android calls setEvents() before TorService does with CIRC causing which makes the app only receive CIRC events
  2. The waiting for lock issue, which is separate and pertains to the tor and control socket threads being unable to recover from a crash state

This idea of yours seems like a good approach to the first one. As for your question of OFF and STARTING I think it should only queue calls before TorService calls setEvents

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

No branches or pull requests

2 participants