mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-23 14:51:34 +00:00
fix(swarm): gracefully disable oneshot handler on dial upgrade errors
Resolves https://github.com/libp2p/rust-libp2p/issues/3269. Pull-Request: #3577.
This commit is contained in:
@ -90,6 +90,8 @@
|
|||||||
- Deprecate methods `Swarm::with_executor`, `Swarm::with_*_executor`, `Swarm::without_executor`.
|
- Deprecate methods `Swarm::with_executor`, `Swarm::with_*_executor`, `Swarm::without_executor`.
|
||||||
Introduce similar methods in `SwarmBuilder`. See [PR 3588].
|
Introduce similar methods in `SwarmBuilder`. See [PR 3588].
|
||||||
|
|
||||||
|
- Gracefully disable oneshot handler on dial upgrade errors. See [PR 3577].
|
||||||
|
|
||||||
[PR 3364]: https://github.com/libp2p/rust-libp2p/pull/3364
|
[PR 3364]: https://github.com/libp2p/rust-libp2p/pull/3364
|
||||||
[PR 3170]: https://github.com/libp2p/rust-libp2p/pull/3170
|
[PR 3170]: https://github.com/libp2p/rust-libp2p/pull/3170
|
||||||
[PR 3134]: https://github.com/libp2p/rust-libp2p/pull/3134
|
[PR 3134]: https://github.com/libp2p/rust-libp2p/pull/3134
|
||||||
@ -106,6 +108,7 @@
|
|||||||
[PR 3254]: https://github.com/libp2p/rust-libp2p/pull/3254
|
[PR 3254]: https://github.com/libp2p/rust-libp2p/pull/3254
|
||||||
[PR 3497]: https://github.com/libp2p/rust-libp2p/pull/3497
|
[PR 3497]: https://github.com/libp2p/rust-libp2p/pull/3497
|
||||||
[PR 3588]: https://github.com/libp2p/rust-libp2p/pull/3588
|
[PR 3588]: https://github.com/libp2p/rust-libp2p/pull/3588
|
||||||
|
[PR 3577]: https://github.com/libp2p/rust-libp2p/pull/3577
|
||||||
|
|
||||||
# 0.41.1
|
# 0.41.1
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ impl<TUpgrErr> ConnectionHandlerUpgrErr<TUpgrErr> {
|
|||||||
|
|
||||||
impl<TUpgrErr> fmt::Display for ConnectionHandlerUpgrErr<TUpgrErr>
|
impl<TUpgrErr> fmt::Display for ConnectionHandlerUpgrErr<TUpgrErr>
|
||||||
where
|
where
|
||||||
TUpgrErr: fmt::Display,
|
TUpgrErr: error::Error + 'static,
|
||||||
{
|
{
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
@ -468,7 +468,10 @@ where
|
|||||||
ConnectionHandlerUpgrErr::Timer => {
|
ConnectionHandlerUpgrErr::Timer => {
|
||||||
write!(f, "Timer error while opening a substream")
|
write!(f, "Timer error while opening a substream")
|
||||||
}
|
}
|
||||||
ConnectionHandlerUpgrErr::Upgrade(err) => write!(f, "{err}"),
|
ConnectionHandlerUpgrErr::Upgrade(err) => {
|
||||||
|
write!(f, "Upgrade: ")?;
|
||||||
|
crate::print_error_chain(f, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +484,7 @@ where
|
|||||||
match self {
|
match self {
|
||||||
ConnectionHandlerUpgrErr::Timeout => None,
|
ConnectionHandlerUpgrErr::Timeout => None,
|
||||||
ConnectionHandlerUpgrErr::Timer => None,
|
ConnectionHandlerUpgrErr::Timer => None,
|
||||||
ConnectionHandlerUpgrErr::Upgrade(err) => Some(err),
|
ConnectionHandlerUpgrErr::Upgrade(_) => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,8 @@ where
|
|||||||
}
|
}
|
||||||
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {
|
ConnectionEvent::DialUpgradeError(DialUpgradeError { error, .. }) => {
|
||||||
if self.pending_error.is_none() {
|
if self.pending_error.is_none() {
|
||||||
self.pending_error = Some(error);
|
log::debug!("DialUpgradeError: {error}");
|
||||||
|
self.keep_alive = KeepAlive::No;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ConnectionEvent::AddressChange(_) | ConnectionEvent::ListenUpgradeError(_) => {}
|
ConnectionEvent::AddressChange(_) | ConnectionEvent::ListenUpgradeError(_) => {}
|
||||||
|
Reference in New Issue
Block a user