Prevent QUIC logs when quic is disabled (#5071)
* Prevent logs and dialing quic multiaddrs when not supported * Merge latest unstable
This commit is contained in:
parent
7582da7855
commit
f02189c86a
@ -18,6 +18,8 @@ pub struct Config {
|
|||||||
pub discovery_enabled: bool,
|
pub discovery_enabled: bool,
|
||||||
/// Whether metrics are enabled.
|
/// Whether metrics are enabled.
|
||||||
pub metrics_enabled: bool,
|
pub metrics_enabled: bool,
|
||||||
|
/// Whether quic is enabled.
|
||||||
|
pub quic_enabled: bool,
|
||||||
/// Target number of peers to connect to.
|
/// Target number of peers to connect to.
|
||||||
pub target_peer_count: usize,
|
pub target_peer_count: usize,
|
||||||
|
|
||||||
@ -37,6 +39,7 @@ impl Default for Config {
|
|||||||
Config {
|
Config {
|
||||||
discovery_enabled: true,
|
discovery_enabled: true,
|
||||||
metrics_enabled: false,
|
metrics_enabled: false,
|
||||||
|
quic_enabled: true,
|
||||||
target_peer_count: DEFAULT_TARGET_PEERS,
|
target_peer_count: DEFAULT_TARGET_PEERS,
|
||||||
status_interval: DEFAULT_STATUS_INTERVAL,
|
status_interval: DEFAULT_STATUS_INTERVAL,
|
||||||
ping_interval_inbound: DEFAULT_PING_INTERVAL_INBOUND,
|
ping_interval_inbound: DEFAULT_PING_INTERVAL_INBOUND,
|
||||||
|
@ -104,6 +104,8 @@ pub struct PeerManager<TSpec: EthSpec> {
|
|||||||
discovery_enabled: bool,
|
discovery_enabled: bool,
|
||||||
/// Keeps track if the current instance is reporting metrics or not.
|
/// Keeps track if the current instance is reporting metrics or not.
|
||||||
metrics_enabled: bool,
|
metrics_enabled: bool,
|
||||||
|
/// Keeps track of whether the QUIC protocol is enabled or not.
|
||||||
|
quic_enabled: bool,
|
||||||
/// The logger associated with the `PeerManager`.
|
/// The logger associated with the `PeerManager`.
|
||||||
log: slog::Logger,
|
log: slog::Logger,
|
||||||
}
|
}
|
||||||
@ -149,6 +151,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
|||||||
status_interval,
|
status_interval,
|
||||||
ping_interval_inbound,
|
ping_interval_inbound,
|
||||||
ping_interval_outbound,
|
ping_interval_outbound,
|
||||||
|
quic_enabled,
|
||||||
} = cfg;
|
} = cfg;
|
||||||
|
|
||||||
// Set up the peer manager heartbeat interval
|
// Set up the peer manager heartbeat interval
|
||||||
@ -167,6 +170,7 @@ impl<TSpec: EthSpec> PeerManager<TSpec> {
|
|||||||
heartbeat,
|
heartbeat,
|
||||||
discovery_enabled,
|
discovery_enabled,
|
||||||
metrics_enabled,
|
metrics_enabled,
|
||||||
|
quic_enabled,
|
||||||
log: log.clone(),
|
log: log.clone(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -96,10 +96,16 @@ impl<TSpec: EthSpec> NetworkBehaviour for PeerManager<TSpec> {
|
|||||||
if let Some(enr) = self.peers_to_dial.pop() {
|
if let Some(enr) = self.peers_to_dial.pop() {
|
||||||
let peer_id = enr.peer_id();
|
let peer_id = enr.peer_id();
|
||||||
self.inject_peer_connection(&peer_id, ConnectingType::Dialing, Some(enr.clone()));
|
self.inject_peer_connection(&peer_id, ConnectingType::Dialing, Some(enr.clone()));
|
||||||
|
|
||||||
|
let quic_multiaddrs = if self.quic_enabled {
|
||||||
let quic_multiaddrs = enr.multiaddr_quic();
|
let quic_multiaddrs = enr.multiaddr_quic();
|
||||||
if !quic_multiaddrs.is_empty() {
|
if !quic_multiaddrs.is_empty() {
|
||||||
debug!(self.log, "Dialing QUIC supported peer"; "peer_id"=> %peer_id, "quic_multiaddrs" => ?quic_multiaddrs);
|
debug!(self.log, "Dialing QUIC supported peer"; "peer_id"=> %peer_id, "quic_multiaddrs" => ?quic_multiaddrs);
|
||||||
}
|
}
|
||||||
|
quic_multiaddrs
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
};
|
||||||
|
|
||||||
// Prioritize Quic connections over Tcp ones.
|
// Prioritize Quic connections over Tcp ones.
|
||||||
let multiaddrs = quic_multiaddrs
|
let multiaddrs = quic_multiaddrs
|
||||||
|
@ -328,6 +328,7 @@ impl<AppReqId: ReqId, TSpec: EthSpec> Network<AppReqId, TSpec> {
|
|||||||
let peer_manager = {
|
let peer_manager = {
|
||||||
let peer_manager_cfg = PeerManagerCfg {
|
let peer_manager_cfg = PeerManagerCfg {
|
||||||
discovery_enabled: !config.disable_discovery,
|
discovery_enabled: !config.disable_discovery,
|
||||||
|
quic_enabled: !config.disable_quic_support,
|
||||||
metrics_enabled: config.metrics_enabled,
|
metrics_enabled: config.metrics_enabled,
|
||||||
target_peer_count: config.target_peers,
|
target_peer_count: config.target_peers,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
Loading…
Reference in New Issue
Block a user