Skip to content

Refactor directory events to use a new FlagPublisher mechanism.

Nick Mathewson requested to merge nickm/arti:flag-publish-2 into main

This approach tries to preserve the current interface, but uses a counter-based event backend to implement a coalescing stream of events that can be represented as small integers. The advantage here is that publishing events no longer needs to be a blocking operation, since there is no queue to fill up.

The present patch differs from the previous verions of this MR in several respects:

  • The code now handle publisher drops correctly. In the previous version, we could sometimes miss it when the last publisher is dropped.
  • Events can now be received after a publisher is dropped. In the previous version, dropping the last publisher cancelled any as-yet-unreceived events.
  • There's a fix for a race condition that could have happened previously if the listener checked a count, then the publisher incremented it, then the publisher called event.notify(), then the listener called event.listen().
  • Documentation is no longer missing
  • Line coverage on events.rs is up to 100%.
Edited by Nick Mathewson

Merge request reports