tor-proto: Make `Channel::wait_for_close` non-experimental
This changes the signature of Channel::wait_for_close
and makes it non-experimental.
Follow-up from !2645 (merged).
The plan is to allow the channel manager to be notified when a channel closes.
Previously Channel::wait_for_close
had a TODO to consider returning a "status indication instead of just ()", so this MR adds some status indication that we can expand later if we want to without requiring a backwards-incompatible change.
Old signature:
pub fn wait_for_close(&self) -> impl futures::Future<Output = ()> + Send + Sync + 'static {
Summary of new signature:
pub fn wait_for_close(
&self,
) -> impl Future<Output = StdResult<CloseInfo, ClosedUnexpectedly>> + Send + Sync + 'static
{ ... }
#[derive(Clone, Debug)]
#[non_exhaustive]
pub struct CloseInfo;
#[derive(Clone, Debug, thiserror::Error)]
#[non_exhaustive]
pub enum ClosedUnexpectedly {
#[error("channel reactor was dropped or panicked before completing")]
ReactorDropped,
#[error("channel reactor had an internal error")]
ReactorError(Error),
}
Edited by opara