RPC: optionally close streams on drop.
Per discussion with @Diziet:
We want to have the property where, by default, closing an RPC session will close any RpcDataStream
owned by that session. This isn't the default behavior for DataStreamCtrl
, so we will need to implement it manually - perhaps by a Drop handler. This should probably be the default behavior: if it isn't, then people are likelier to implement accidental race conditions where their programs work by accident because their RpcDataStream
handles are dropped a little later than their connections arrive.
We also need a way to relax this behavior, and allow a DataStream
to outlive its RpcDataStream
when that is desired. Maybe downgrading to a weak reference is the answer? But it can't be a real weak reference, since nothing else would actually be holding the RpcDataStream
.
We also need to decide what happens if an RpcDataStream
is released (but not explicitly terminated) by the RPC code.