mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-20 05:16:35 +00:00
feat(swarm)!: report connections to our own PeerId
in separate error (#3377)
Previously, inbound connections that happened to resolve to our own `PeerId` were reported as `WrongPeerId`. With this patch, we now report those in a dedicated `LocalPeerId` error. Related: #3205.
This commit is contained in:
@ -228,7 +228,7 @@ impl<TBvEv, THandleErr> super::Recorder<libp2p_swarm::SwarmEvent<TBvEv, THandleE
|
||||
libp2p_swarm::DialError::ConnectionLimit(_) => {
|
||||
record(OutgoingConnectionErrorError::ConnectionLimit)
|
||||
}
|
||||
libp2p_swarm::DialError::LocalPeerId => {
|
||||
libp2p_swarm::DialError::LocalPeerId { .. } => {
|
||||
record(OutgoingConnectionErrorError::LocalPeerId)
|
||||
}
|
||||
libp2p_swarm::DialError::NoAddresses => {
|
||||
@ -361,6 +361,7 @@ struct IncomingConnectionErrorLabels {
|
||||
#[derive(EncodeLabelValue, Hash, Clone, Eq, PartialEq, Debug)]
|
||||
enum PendingInboundConnectionError {
|
||||
WrongPeerId,
|
||||
LocalPeerId,
|
||||
TransportErrorMultiaddrNotSupported,
|
||||
TransportErrorOther,
|
||||
Aborted,
|
||||
@ -373,6 +374,9 @@ impl From<&libp2p_swarm::PendingInboundConnectionError> for PendingInboundConnec
|
||||
libp2p_swarm::PendingInboundConnectionError::WrongPeerId { .. } => {
|
||||
PendingInboundConnectionError::WrongPeerId
|
||||
}
|
||||
libp2p_swarm::PendingInboundConnectionError::LocalPeerId { .. } => {
|
||||
PendingInboundConnectionError::LocalPeerId
|
||||
}
|
||||
libp2p_swarm::PendingInboundConnectionError::ConnectionLimit(_) => {
|
||||
PendingInboundConnectionError::ConnectionLimit
|
||||
}
|
||||
|
Reference in New Issue
Block a user