Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite tester con #3938

Merged
merged 7 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion massa-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tracing = { version = "0.1", features = [
"max_level_debug",
"release_max_level_debug",
] }
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "cf4cb09deda8cdd9b8893cc9595ac3b255aa74c9" }
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "2338a3256655ece10ec5d11398c0bdb6b93b764c" }
tracing-subscriber = "0.3"
paw = "1.0"
structopt = { version = "0.3", features = ["paw"] }
Expand Down
4 changes: 3 additions & 1 deletion massa-node/base_config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,10 @@
max_endorsements_propagation_time = 48000
# number of thread tester
thread_tester_count = 5
# Nb max in connections that we accept
max_in_connections = 100
# Peer default category limits
default_category_info = { target_out_connections = 10, max_in_connections_per_ip = 2, max_in_connections_pre_handshake = 100, max_in_connections_post_handshake = 15}
default_category_info = { target_out_connections = 10, max_in_connections_per_ip = 2, max_in_connections_pre_handshake = 70, max_in_connections_post_handshake = 15}
# Peer categories limits
[protocol.peers_categories]
Bootstrap = { target_out_connections = 1, max_in_connections_per_ip = 1, max_in_connections_pre_handshake = 8, max_in_connections_post_handshake = 1}
Expand Down
1 change: 1 addition & 0 deletions massa-node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ async fn launch(
read_write_limit_bytes_per_second: SETTINGS.protocol.read_write_limit_bytes_per_second
as u128,
try_connection_timer: SETTINGS.protocol.try_connection_timer,
max_in_connections: SETTINGS.protocol.max_in_connections,
timeout_connection: SETTINGS.protocol.timeout_connection,
routable_ip: SETTINGS
.protocol
Expand Down
2 changes: 2 additions & 0 deletions massa-node/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ pub struct ProtocolSettings {
pub try_connection_timer: MassaTime,
/// Timeout connection
pub timeout_connection: MassaTime,
/// Nb in connections
pub max_in_connections: usize,
/// Peers limits per category
pub peers_categories: HashMap<String, PeerCategoryInfo>,
/// Limits for default category
Expand Down
2 changes: 1 addition & 1 deletion massa-protocol-exports/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ thiserror = "1.0"
nom = "7.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "cf4cb09deda8cdd9b8893cc9595ac3b255aa74c9" }
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "2338a3256655ece10ec5d11398c0bdb6b93b764c" }
tempfile = { version = "3.3", optional = true } # use with testing feature
mockall = "0.11.4"

Expand Down
2 changes: 2 additions & 0 deletions massa-protocol-exports/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ pub struct ProtocolConfig {
pub last_start_period: u64,
/// try connection timer
pub try_connection_timer: MassaTime,
/// Max in connections
pub max_in_connections: usize,
/// Timeout connection
pub timeout_connection: MassaTime,
/// Number of bytes per second that can be read/write in a connection (should be a 10 multiplier)
Expand Down
1 change: 1 addition & 0 deletions massa-protocol-exports/src/test_exports/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ impl Default for ProtocolConfig {
timeout_connection: MassaTime::from_millis(1000),
try_connection_timer: MassaTime::from_millis(5000),
routable_ip: None,
max_in_connections: 10,
debug: true,
peers_categories: HashMap::default(),
default_category_info: PeerCategoryInfo {
Expand Down
2 changes: 1 addition & 1 deletion massa-protocol-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ crossbeam = "0.8"
serde_json = "1.0"
nom = "7.1"
num_enum = "0.5"
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "cf4cb09deda8cdd9b8893cc9595ac3b255aa74c9" }
peernet = { git = "https://github.com/massalabs/PeerNet", rev = "2338a3256655ece10ec5d11398c0bdb6b93b764c" }
tempfile = { version = "3.3", optional = true } # use with testing feature
rayon = "1.7.0"
lru = "0.10.0"
Expand Down
4 changes: 2 additions & 2 deletions massa-protocol-worker/src/handlers/peer_handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ impl PeerManagementHandler {
match message {
PeerManagementMessage::NewPeerConnected((peer_id, listeners)) => {
debug!("Received peer message: NewPeerConnected from {}", peer_id);
if let Err(e) = test_sender.send((peer_id, listeners)) {
if let Err(e) = test_sender.try_send((peer_id, listeners)) {
error!("error when sending msg to peer tester : {}", e);
}
}
PeerManagementMessage::ListPeers(peers) => {
debug!("Received peer message: List peers from {}", peer_id);
for (peer_id, listeners) in peers.into_iter() {
if let Err(e) = test_sender.send((peer_id, listeners)) {
if let Err(e) = test_sender.try_send((peer_id, listeners)) {
error!("error when sending msg to peer tester : {}", e);
}
}
Expand Down
Loading