Define a "mostly bounded queue" type
Several places in tor-proto
, we have a pattern where we combine a bounded MPSC queue with an unbounded VecDeque
: Mostly we use the bounded queue, but occasionally, when we have a must-send message and the bounded queue is full, we use the unbounded VecDeque.
This could be reimplemented using a "mostly bounded" queue: such a queue would be internally unbounded, but have a "soft bound". It would provide a Sink
implementation that would respect the soft bound, and a send_unbounded
implementation that would send unconditionally.
This would ideally obviate the need for these three queues.
-
CircHop::outbound
. -
circuit::Reactor::outbound
. channel::reactor::SpecialOutgoing
@Diziet says they have ideas about how to build one of these.