Make errors on listener non-fatal (#1427)

* Make errors on listener non-fatal

* Fix bad rename

* Some changes to trait bounds

* Fix noise tests

* Apply suggestions from code review

Co-Authored-By: Toralf Wittner <tw@dtex.org>

* Add reason for closure

* Fix intra-doc link

Co-authored-by: Toralf Wittner <tw@dtex.org>
This commit is contained in:
Pierre Krieger
2020-02-13 12:05:45 +01:00
committed by GitHub
parent e2ddab223d
commit bbed28b3ec
20 changed files with 246 additions and 87 deletions

View File

@@ -109,7 +109,7 @@ where
{
type Output = Connection<T::Output>;
type Error = Error<T::Error>;
type Listener = BoxStream<'static, Result<ListenerEvent<Self::ListenerUpgrade>, Self::Error>>;
type Listener = BoxStream<'static, Result<ListenerEvent<Self::ListenerUpgrade, Self::Error>, Self::Error>>;
type ListenerUpgrade = BoxFuture<'static, Result<Self::Output, Self::Error>>;
type Dial = BoxFuture<'static, Result<Self::Output, Self::Error>>;
@@ -147,6 +147,9 @@ where
a = a.with(proto.clone());
ListenerEvent::AddressExpired(a)
}
ListenerEvent::Error(err) => {
ListenerEvent::Error(Error::Transport(err))
}
ListenerEvent::Upgrade { upgrade, mut local_addr, mut remote_addr } => {
local_addr = local_addr.with(proto.clone());
remote_addr = remote_addr.with(proto.clone());

View File

@@ -117,7 +117,7 @@ where
}
/// Type alias corresponding to `framed::WsConfig::Listener`.
pub type InnerStream<T, E> = BoxStream<'static, Result<ListenerEvent<InnerFuture<T, E>>, Error<E>>>;
pub type InnerStream<T, E> = BoxStream<'static, Result<ListenerEvent<InnerFuture<T, E>, Error<E>>, Error<E>>>;
/// Type alias corresponding to `framed::WsConfig::Dial` and `framed::WsConfig::ListenerUpgrade`.
pub type InnerFuture<T, E> = BoxFuture<'static, Result<Connection<T>, Error<E>>>;