Fix mapping of upgrade errors. (#656)

The current implementation of `MapUpgradeErr` implements `InboundUpgrade`
and `OutboundUpgrade` and applies the transformation in both cases which
means that mapping is always applied to inbound and outbound upgrade
errors. This commit uses separate `MapInboundUpgradeErr` and
`MapOutboundUpgradeErr` types which implements both traits but only map
errors in one direction.
This commit is contained in:
Toralf Wittner
2018-11-19 16:08:00 +01:00
committed by GitHub
parent e7bffd009f
commit 64af676178
3 changed files with 68 additions and 22 deletions

View File

@ -770,7 +770,7 @@ where
type InboundProtocol =
upgrade::OrUpgrade<
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapInboundUpgradeErr<
upgrade::MapInboundUpgrade<
TProto1::InboundProtocol,
fn(TProto1Out) -> EitherOutput<TProto1Out, TProto2Out>
@ -783,7 +783,7 @@ where
>
>,
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapInboundUpgradeErr<
upgrade::MapInboundUpgrade<
TProto2::InboundProtocol,
fn(TProto2Out) -> EitherOutput<TProto1Out, TProto2Out>
@ -800,7 +800,7 @@ where
type OutboundProtocol =
upgrade::OrUpgrade<
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapOutboundUpgradeErr<
upgrade::MapOutboundUpgrade<
TProto1::OutboundProtocol,
fn(TProto1Out) -> EitherOutput<TProto1Out, TProto2Out>
@ -813,7 +813,7 @@ where
>
>,
upgrade::Toggleable<
upgrade::MapUpgradeErr<
upgrade::MapOutboundUpgradeErr<
upgrade::MapOutboundUpgrade<
TProto2::OutboundProtocol,
fn(TProto2Out) -> EitherOutput<TProto1Out, TProto2Out>