Skip to content

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

Open

Description

@eighthave

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?

Activity

  1. bitmold commented on Apr 29, 2022

    @bitmold
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions