From 2ad8dec20a2f9f8c5f5782fa4ae8e9f7738b8345 Mon Sep 17 00:00:00 2001 From: modship Date: Thu, 27 Apr 2023 17:29:40 +0200 Subject: [PATCH] update OutConnectionConfig::Tcp with default value (can set rate limit) --- massa-protocol-worker-2/src/connectivity.rs | 4 ++-- massa-protocol-worker-2/src/handlers/peer_handler/tester.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/massa-protocol-worker-2/src/connectivity.rs b/massa-protocol-worker-2/src/connectivity.rs index cd55abd7a1d..ab28925a6e9 100644 --- a/massa-protocol-worker-2/src/connectivity.rs +++ b/massa-protocol-worker-2/src/connectivity.rs @@ -8,7 +8,7 @@ use massa_protocol_exports_2::{ProtocolConfig, ProtocolError}; use massa_storage::Storage; use parking_lot::RwLock; use peernet::peer_id::PeerId; -use peernet::transports::{OutConnectionConfig, TcpOutConnectionConfig, TransportType}; +use peernet::transports::{OutConnectionConfig, TransportType}; use std::collections::HashMap; use std::net::SocketAddr; use std::{num::NonZeroUsize, sync::Arc}; @@ -206,7 +206,7 @@ pub(crate) fn start_connectivity_thread( println!("Trying to connect to peer {:?}", addr); } // We only manage TCP for now - if let Err(err) = network_controller.try_connect(*addr, Duration::from_millis(200), &OutConnectionConfig::Tcp(Box::new(TcpOutConnectionConfig {}))) { + if let Err(err) = network_controller.try_connect(*addr, Duration::from_millis(200), &OutConnectionConfig::Tcp(Box::default())) { warn!("Failed to connect to peer {:?}: {:?}", addr, err); } }; diff --git a/massa-protocol-worker-2/src/handlers/peer_handler/tester.rs b/massa-protocol-worker-2/src/handlers/peer_handler/tester.rs index b51e67a3e1c..5a50a9387b4 100644 --- a/massa-protocol-worker-2/src/handlers/peer_handler/tester.rs +++ b/massa-protocol-worker-2/src/handlers/peer_handler/tester.rs @@ -15,7 +15,7 @@ use peernet::{ network_manager::PeerNetManager, peer::InitConnectionHandler, peer_id::PeerId, - transports::{endpoint::Endpoint, OutConnectionConfig, TcpOutConnectionConfig, TransportType}, + transports::{endpoint::Endpoint, OutConnectionConfig, TransportType}, types::KeyPair, }; use std::cmp::Reverse; @@ -227,7 +227,7 @@ impl Tester { let _res = network_manager.try_connect( *addr, Duration::from_millis(500), - &OutConnectionConfig::Tcp(Box::new(TcpOutConnectionConfig {})), + &OutConnectionConfig::Tcp(Box::default()), ); }); }, @@ -258,7 +258,7 @@ impl Tester { let _res = network_manager.try_connect( *listener.0, Duration::from_millis(200), - &OutConnectionConfig::Tcp(Box::new(TcpOutConnectionConfig {})), + &OutConnectionConfig::Tcp(Box::default()), ); }); }