Open dignifiedquire opened 1 week ago
Some more details from when I had a quick look at this last week and wrote the above:
Regarding 1) above: What I thought of doing would be to wrap the impl Stream
returned from Gossip::join_with_stream
in a struct that a) forwards the stream impl to the inner type, and b) has a Drop impl which triggers a oneshot sender. The receiver would need to be listened for in the actor, to mark the subscription receiver as dropped and trigger disconnect if it the command sender is dropped as well and it is the last subscription for the topic. (The drop notification for the command sender already works because the command receiver in the gossip is triggered on drop of the sender handle).
Regarding 2) above, if we do not want to do a wire-breaking change, we have to mark connections as obsolete once we processed a DisconnectPeer
event, and then clean it up some time later (to allow the terminal message to be sent out). We will not get a response for the terminal message, and quic does not give us any notification once the message is delivered, so a timer is all we can do I think. With a wire breaking change this would be solveable cleanly, e.g. with the approach for connection termination taken in iroh-willow.
When dropping the subscription stream, neither connections nor subscriptions are fully cleaned up.
from @Frando