mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 06:41:34 +00:00
feat: don't report inbound stream upgrade errors to handler
When an inbound stream upgrade fails, there isn't a whole lot we can do about that in the handler. In fact, for several errors, we wouldn't even know which specific handler to target, for example, `NegotiationFailed`. Similiarly, in case of an IO error during the upgrade, we don't know which handler the stream was eventually meant to be for. Pull-Request: #3605.
This commit is contained in:
@ -150,14 +150,7 @@ impl ConnectionHandler for Handler {
|
||||
}));
|
||||
}
|
||||
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
|
||||
match error {
|
||||
ConnectionHandlerUpgrErr::Timeout => {}
|
||||
ConnectionHandlerUpgrErr::Timer => {}
|
||||
ConnectionHandlerUpgrErr::Upgrade(error) => match error {
|
||||
libp2p_core::UpgradeError::Select(_) => {}
|
||||
libp2p_core::UpgradeError::Apply(v) => void::unreachable(v),
|
||||
},
|
||||
}
|
||||
void::unreachable(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ use libp2p_swarm::{
|
||||
ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
||||
ListenUpgradeError,
|
||||
},
|
||||
ConnectionHandler, ConnectionHandlerEvent, ConnectionHandlerUpgrErr, KeepAlive, StreamProtocol,
|
||||
SubstreamProtocol,
|
||||
ConnectionHandler, ConnectionHandlerEvent, KeepAlive, StreamProtocol, SubstreamProtocol,
|
||||
};
|
||||
use log::error;
|
||||
use void::Void;
|
||||
@ -106,14 +105,7 @@ impl ConnectionHandler for Handler {
|
||||
}
|
||||
ConnectionEvent::AddressChange(_) => {}
|
||||
ConnectionEvent::ListenUpgradeError(ListenUpgradeError { info: (), error }) => {
|
||||
match error {
|
||||
ConnectionHandlerUpgrErr::Timeout => {}
|
||||
ConnectionHandlerUpgrErr::Timer => {}
|
||||
ConnectionHandlerUpgrErr::Upgrade(error) => match error {
|
||||
libp2p_core::UpgradeError::Select(_) => {}
|
||||
libp2p_core::UpgradeError::Apply(v) => void::unreachable(v),
|
||||
},
|
||||
}
|
||||
void::unreachable(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user