Skip to content

proto: methods to wait until a channel/circuit is shut down.

Nick Mathewson requested to merge nickm/arti:wait_for_close into main

The implementation here is perhaps excessively simple: we put a oneshot::Sender in the Reactor object, and a Shared<oneshot::Receiver> in the circuit or channel. When the reactor is dropped, any copy of the Shared<Receiver> will yield Err(Cancelled).

I'm marking these methods as experimental because I'm not sure I've thought of all the implications here, and we might want to change things around.

Down the road, these methods might want to yield a Result<> indicating why the reactor was shut down.

This feature was inspired by a request from Saksham Mittal, and a felt need while working on !1472 (merged).

Merge request reports

Loading