mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-05-30 19:21:19 +00:00
fix(kad): reduce noise of "remote supports our protocol" log
This PR changes the logging of the Kademlia connection handler related to the remote Kademlia mode changes: - Downgrade log level for the remote kademlia protocol report from `info` to `debug`. - Introduce connection_id for the handler to improve logging. Pull-Request: #4278.
This commit is contained in:
parent
72fd50ae6c
commit
e65155281e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3149,7 +3149,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libp2p-swarm"
|
name = "libp2p-swarm"
|
||||||
version = "0.43.2"
|
version = "0.43.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-std",
|
"async-std",
|
||||||
"either",
|
"either",
|
||||||
|
@ -87,7 +87,7 @@ libp2p-quic = { version = "0.9.0-alpha", path = "transports/quic" }
|
|||||||
libp2p-relay = { version = "0.16.1", path = "protocols/relay" }
|
libp2p-relay = { version = "0.16.1", path = "protocols/relay" }
|
||||||
libp2p-rendezvous = { version = "0.13.0", path = "protocols/rendezvous" }
|
libp2p-rendezvous = { version = "0.13.0", path = "protocols/rendezvous" }
|
||||||
libp2p-request-response = { version = "0.25.1", path = "protocols/request-response" }
|
libp2p-request-response = { version = "0.25.1", path = "protocols/request-response" }
|
||||||
libp2p-swarm = { version = "0.43.2", path = "swarm" }
|
libp2p-swarm = { version = "0.43.3", path = "swarm" }
|
||||||
libp2p-swarm-derive = { version = "0.33.0", path = "swarm-derive" }
|
libp2p-swarm-derive = { version = "0.33.0", path = "swarm-derive" }
|
||||||
libp2p-swarm-test = { version = "0.2.0", path = "swarm-test" }
|
libp2p-swarm-test = { version = "0.2.0", path = "swarm-test" }
|
||||||
libp2p-tcp = { version = "0.40.0", path = "transports/tcp" }
|
libp2p-tcp = { version = "0.40.0", path = "transports/tcp" }
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
- Implement common traits on `RoutingUpdate`.
|
- Implement common traits on `RoutingUpdate`.
|
||||||
See [PR 4270].
|
See [PR 4270].
|
||||||
|
- Reduce noise of "remote supports our protocol" log.
|
||||||
|
See [PR 4278].
|
||||||
|
|
||||||
[PR 4270]: https://github.com/libp2p/rust-libp2p/pull/4270
|
[PR 4270]: https://github.com/libp2p/rust-libp2p/pull/4270
|
||||||
|
[PR 4278]: https://github.com/libp2p/rust-libp2p/pull/4278
|
||||||
|
|
||||||
## 0.44.3
|
## 0.44.3
|
||||||
|
|
||||||
|
@ -2081,6 +2081,7 @@ where
|
|||||||
connected_point,
|
connected_point,
|
||||||
peer,
|
peer,
|
||||||
self.mode,
|
self.mode,
|
||||||
|
connection_id,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2103,6 +2104,7 @@ where
|
|||||||
connected_point,
|
connected_point,
|
||||||
peer,
|
peer,
|
||||||
self.mode,
|
self.mode,
|
||||||
|
connection_id,
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ use libp2p_swarm::handler::{
|
|||||||
ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
ConnectionEvent, DialUpgradeError, FullyNegotiatedInbound, FullyNegotiatedOutbound,
|
||||||
};
|
};
|
||||||
use libp2p_swarm::{
|
use libp2p_swarm::{
|
||||||
ConnectionHandler, ConnectionHandlerEvent, KeepAlive, Stream, StreamUpgradeError,
|
ConnectionHandler, ConnectionHandlerEvent, ConnectionId, KeepAlive, Stream, StreamUpgradeError,
|
||||||
SubstreamProtocol, SupportedProtocols,
|
SubstreamProtocol, SupportedProtocols,
|
||||||
};
|
};
|
||||||
use log::trace;
|
use log::trace;
|
||||||
@ -94,6 +94,9 @@ pub struct KademliaHandler {
|
|||||||
protocol_status: ProtocolStatus,
|
protocol_status: ProtocolStatus,
|
||||||
|
|
||||||
remote_supported_protocols: SupportedProtocols,
|
remote_supported_protocols: SupportedProtocols,
|
||||||
|
|
||||||
|
/// The ID of this connection.
|
||||||
|
connection_id: ConnectionId,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The states of protocol confirmation that a connection
|
/// The states of protocol confirmation that a connection
|
||||||
@ -474,6 +477,7 @@ impl KademliaHandler {
|
|||||||
endpoint: ConnectedPoint,
|
endpoint: ConnectedPoint,
|
||||||
remote_peer_id: PeerId,
|
remote_peer_id: PeerId,
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
|
connection_id: ConnectionId,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
match &endpoint {
|
match &endpoint {
|
||||||
ConnectedPoint::Dialer { .. } => {
|
ConnectedPoint::Dialer { .. } => {
|
||||||
@ -504,6 +508,7 @@ impl KademliaHandler {
|
|||||||
keep_alive,
|
keep_alive,
|
||||||
protocol_status: ProtocolStatus::Unknown,
|
protocol_status: ProtocolStatus::Unknown,
|
||||||
remote_supported_protocols: Default::default(),
|
remote_supported_protocols: Default::default(),
|
||||||
|
connection_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,17 +808,19 @@ impl ConnectionHandler for KademliaHandler {
|
|||||||
match (remote_supports_our_kademlia_protocols, self.protocol_status) {
|
match (remote_supports_our_kademlia_protocols, self.protocol_status) {
|
||||||
(true, ProtocolStatus::Confirmed | ProtocolStatus::Reported) => {}
|
(true, ProtocolStatus::Confirmed | ProtocolStatus::Reported) => {}
|
||||||
(true, _) => {
|
(true, _) => {
|
||||||
log::info!(
|
log::debug!(
|
||||||
"Remote {} now supports our kademlia protocol",
|
"Remote {} now supports our kademlia protocol on connection {}",
|
||||||
self.remote_peer_id
|
self.remote_peer_id,
|
||||||
|
self.connection_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.protocol_status = ProtocolStatus::Confirmed;
|
self.protocol_status = ProtocolStatus::Confirmed;
|
||||||
}
|
}
|
||||||
(false, ProtocolStatus::Confirmed | ProtocolStatus::Reported) => {
|
(false, ProtocolStatus::Confirmed | ProtocolStatus::Reported) => {
|
||||||
log::info!(
|
log::debug!(
|
||||||
"Remote {} no longer supports our kademlia protocol",
|
"Remote {} no longer supports our kademlia protocol on connection {}",
|
||||||
self.remote_peer_id
|
self.remote_peer_id,
|
||||||
|
self.connection_id,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.protocol_status = ProtocolStatus::NotSupported;
|
self.protocol_status = ProtocolStatus::NotSupported;
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
|
## 0.43.3 - unreleased
|
||||||
|
|
||||||
|
- Implement `Display` for `ConnectionId`.
|
||||||
|
See [PR 4278].
|
||||||
|
|
||||||
|
[PR 4278]: https://github.com/libp2p/rust-libp2p/pull/4278
|
||||||
|
|
||||||
## 0.43.2
|
## 0.43.2
|
||||||
- Display the cause of a `ListenError::Denied`.
|
- Display the cause of a `ListenError::Denied`.
|
||||||
See [PR 4232]
|
See [PR 4232]
|
||||||
|
@ -3,7 +3,7 @@ name = "libp2p-swarm"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
rust-version = { workspace = true }
|
rust-version = { workspace = true }
|
||||||
description = "The libp2p swarm"
|
description = "The libp2p swarm"
|
||||||
version = "0.43.2"
|
version = "0.43.3"
|
||||||
authors = ["Parity Technologies <admin@parity.io>"]
|
authors = ["Parity Technologies <admin@parity.io>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/libp2p/rust-libp2p"
|
repository = "https://github.com/libp2p/rust-libp2p"
|
||||||
|
@ -53,6 +53,7 @@ use libp2p_core::upgrade::{NegotiationError, ProtocolError};
|
|||||||
use libp2p_core::Endpoint;
|
use libp2p_core::Endpoint;
|
||||||
use libp2p_identity::PeerId;
|
use libp2p_identity::PeerId;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use std::fmt::{Display, Formatter};
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
use std::task::Waker;
|
use std::task::Waker;
|
||||||
@ -82,6 +83,12 @@ impl ConnectionId {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Display for ConnectionId {
|
||||||
|
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||||
|
write!(f, "{}", self.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Information about a successfully established connection.
|
/// Information about a successfully established connection.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
pub(crate) struct Connected {
|
pub(crate) struct Connected {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user