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

Refactor to prepare whitelist peers #2297

Merged
merged 44 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0072a74
Introduce PeerType enum and associated configs and counters.
AureliaDolo Feb 15, 2022
3e704eb
Compile tests.
AureliaDolo Feb 16, 2022
a407719
Rename whitelist_connections -> whitelist_connction_count for
AureliaDolo Feb 16, 2022
88a2acf
Remove Banned variant.
AureliaDolo Feb 16, 2022
992dfb9
Use peer info db update when possible.
AureliaDolo Feb 16, 2022
cdaef51
Moved peer info db to tests.
AureliaDolo Feb 16, 2022
1ea833e
A few fixes.
AureliaDolo Feb 16, 2022
edf8c98
Refactor get_out_connection_candidate_ips.
AureliaDolo Feb 16, 2022
cb96185
Refactor new_out_connection_attempt.
AureliaDolo Feb 16, 2022
688bfcf
Improve readability.
AureliaDolo Feb 17, 2022
746e630
Fix tests (and typos)
AureliaDolo Feb 17, 2022
04abb56
Merge branch 'main' into feature/network/whitelist_peers
AureliaDolo Feb 21, 2022
3a06dd2
Reorganize peer info db and improve doc.
AureliaDolo Feb 21, 2022
dde627d
Fix config and initial peers file.
AureliaDolo Feb 21, 2022
5c36164
Update doc.
AureliaDolo Feb 22, 2022
a67f5a5
Inline a few methods.
AureliaDolo Feb 22, 2022
2845bfc
Add doc.
AureliaDolo Feb 22, 2022
6ae1d5e
Make ConnectionCount fields more explicit.
AureliaDolo Feb 23, 2022
06f35d3
A little refacto.
AureliaDolo Feb 24, 2022
12c2f73
Update new_out_connection_attempt.
AureliaDolo Feb 24, 2022
b46dedf
Order on peer type and some doc.
AureliaDolo Feb 28, 2022
4ef2b63
Fixed tests.
AureliaDolo Feb 28, 2022
d87c547
Update unban.
AureliaDolo Feb 28, 2022
9d02317
Refactor out_connection_closed.
AureliaDolo Feb 28, 2022
6ed91de
refactor in_connection_closed
AureliaDolo Feb 28, 2022
393bc96
Update try_out_connection_attempt_success.
AureliaDolo Feb 28, 2022
e80fe8a
Update out_connection_attempt_failed.
AureliaDolo Feb 28, 2022
b333651
update try_new_in_connection.
AureliaDolo Feb 28, 2022
7348c5e
Update new_out_connection_attempt.
AureliaDolo Feb 28, 2022
8e6d173
Update get_out_connection_candidate_ips.
AureliaDolo Feb 28, 2022
06c78f7
Roll back when global updates.
AureliaDolo Feb 28, 2022
8283472
Merge branch 'main' into feature/network/whitelist_peers
AureliaDolo Feb 28, 2022
fbaa549
Remove dead code.
AureliaDolo Mar 3, 2022
4220937
First refacto to remove rollback.
AurelienFT Mar 4, 2022
1afdc9f
Create a more generic way to handle peer type.
AurelienFT Mar 5, 2022
2af1ebd
Remove duplicate code.
AurelienFT Mar 5, 2022
a38e3a1
Remove unused parameters and add sorting on connection candidate.
AurelienFT Mar 7, 2022
f6b32f8
Merge pull request #2379 from massalabs/refactor/whitelist_peers
AureliaDolo Mar 7, 2022
af7ca05
Merge branch 'main' into feature/network/whitelist_peers
AureliaDolo Mar 8, 2022
c611b80
Change network peer types definitions in config.toml of the node to m…
AurelienFT Mar 8, 2022
077cd51
Fix test by reverting order of peer types conenctions.
AurelienFT Mar 8, 2022
8438c93
Fix check that we can remove a try of connection after we already rem…
AurelienFT Mar 8, 2022
c1a0ade
Clippy
AureliaDolo Mar 9, 2022
984e198
Merge branch 'main' into feature/network/whitelist_peers
AureliaDolo Mar 10, 2022
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: 3 additions & 5 deletions massa-network/src/network_worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -882,16 +882,14 @@ impl NetworkWorker {
NetworkCommand::Unban(ip) => self.peer_info_db.unban(ip).await?,
NetworkCommand::GetStats { response_tx } => {
let res = NetworkStats {
in_connection_count: self.peer_info_db.active_in_nonbootstrap_connections
as u64, // TODO: add bootstrap connections ... see #1312
out_connection_count: self.peer_info_db.active_out_nonbootstrap_connections
as u64, // TODO: add bootstrap connections ... see #1312
in_connection_count: self.peer_info_db.get_in_connection_count(),
out_connection_count: self.peer_info_db.get_out_connection_count(),
known_peer_count: self.peer_info_db.peers.len() as u64,
banned_peer_count: self
.peer_info_db
.peers
.iter()
.filter(|(_, p)| p.banned)
.filter(|(_, p)| p.peer_type == PeerType::Banned)
.fold(0, |acc, _| acc + 1),
active_node_count: self.active_nodes.len() as u64,
};
Expand Down
Loading