feat(swarm)!: remove unused PendingConnectionError::Io variant (#3373)

This variant is never constructed.
This commit is contained in:
Thomas Eizinger
2023-01-26 16:26:54 +11:00
committed by GitHub
parent c94aabf8f6
commit 90af08cb59
4 changed files with 5 additions and 10 deletions

View File

@ -364,7 +364,6 @@ enum PendingInboundConnectionError {
TransportErrorMultiaddrNotSupported, TransportErrorMultiaddrNotSupported,
TransportErrorOther, TransportErrorOther,
Aborted, Aborted,
Io,
ConnectionLimit, ConnectionLimit,
} }
@ -386,7 +385,6 @@ impl From<&libp2p_swarm::PendingInboundConnectionError> for PendingInboundConnec
libp2p_swarm::PendingInboundConnectionError::Aborted => { libp2p_swarm::PendingInboundConnectionError::Aborted => {
PendingInboundConnectionError::Aborted PendingInboundConnectionError::Aborted
} }
libp2p_swarm::PendingInboundConnectionError::IO(_) => PendingInboundConnectionError::Io,
} }
} }
} }

View File

@ -23,6 +23,10 @@
If you have previously set `connection_event_buffer_size` you should re-evaluate what a good size for a _per connection_ buffer is. If you have previously set `connection_event_buffer_size` you should re-evaluate what a good size for a _per connection_ buffer is.
See [PR 3188]. See [PR 3188].
- Remove `PendingConnectionError:::IO` variant.
This was never constructed.
See [PR 3373].
[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
@ -31,6 +35,7 @@
[PR 3272]: https://github.com/libp2p/rust-libp2p/pull/3272 [PR 3272]: https://github.com/libp2p/rust-libp2p/pull/3272
[PR 3327]: https://github.com/libp2p/rust-libp2p/pull/3327 [PR 3327]: https://github.com/libp2p/rust-libp2p/pull/3327
[PR 3188]: https://github.com/libp2p/rust-libp2p/pull/3188 [PR 3188]: https://github.com/libp2p/rust-libp2p/pull/3188
[PR 3373]: https://github.com/libp2p/rust-libp2p/pull/3373
# 0.41.1 # 0.41.1

View File

@ -101,10 +101,6 @@ pub enum PendingConnectionError<TTransErr> {
obtained: PeerId, obtained: PeerId,
endpoint: ConnectedPoint, endpoint: ConnectedPoint,
}, },
/// An I/O error occurred on the connection.
// TODO: Eventually this should also be a custom error?
IO(io::Error),
} }
impl<T> PendingConnectionError<T> { impl<T> PendingConnectionError<T> {
@ -118,7 +114,6 @@ impl<T> PendingConnectionError<T> {
PendingConnectionError::WrongPeerId { obtained, endpoint } => { PendingConnectionError::WrongPeerId { obtained, endpoint } => {
PendingConnectionError::WrongPeerId { obtained, endpoint } PendingConnectionError::WrongPeerId { obtained, endpoint }
} }
PendingConnectionError::IO(e) => PendingConnectionError::IO(e),
} }
} }
} }
@ -129,7 +124,6 @@ where
{ {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self { match self {
PendingConnectionError::IO(err) => write!(f, "Pending connection: I/O error: {err}"),
PendingConnectionError::Aborted => write!(f, "Pending connection: Aborted."), PendingConnectionError::Aborted => write!(f, "Pending connection: Aborted."),
PendingConnectionError::Transport(err) => { PendingConnectionError::Transport(err) => {
write!( write!(
@ -156,7 +150,6 @@ where
{ {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self { match self {
PendingConnectionError::IO(err) => Some(err),
PendingConnectionError::Transport(_) => None, PendingConnectionError::Transport(_) => None,
PendingConnectionError::WrongPeerId { .. } => None, PendingConnectionError::WrongPeerId { .. } => None,
PendingConnectionError::Aborted => None, PendingConnectionError::Aborted => None,

View File

@ -1611,7 +1611,6 @@ impl From<PendingOutboundConnectionError> for DialError {
PendingConnectionError::WrongPeerId { obtained, endpoint } => { PendingConnectionError::WrongPeerId { obtained, endpoint } => {
DialError::WrongPeerId { obtained, endpoint } DialError::WrongPeerId { obtained, endpoint }
} }
PendingConnectionError::IO(e) => DialError::ConnectionIo(e),
PendingConnectionError::Transport(e) => DialError::Transport(e), PendingConnectionError::Transport(e) => DialError::Transport(e),
} }
} }