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

P2P Refactor connections management #1187

Merged
merged 12 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
10 changes: 5 additions & 5 deletions plugins/net_plugin/include/eosio/net_plugin/auto_bp_peering.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class bp_connection_manager {
// Only called from connection strand
std::size_t num_established_clients() const {
uint32_t num_clients = 0;
self()->for_each_connection([&num_clients](auto&& conn) {
self()->connections.for_each_connection([&num_clients](auto&& conn) {
if (established_client_connection(conn)) {
++num_clients;
}
Expand All @@ -158,8 +158,8 @@ class bp_connection_manager {
// This should only be called after the first handshake message is received to check if an incoming connection
// has exceeded the pre-configured max_client_count limit.
bool exceeding_connection_limit(Connection* new_connection) const {
return auto_bp_peering_enabled() && self()->max_client_count != 0 &&
established_client_connection(new_connection) && num_established_clients() > self()->max_client_count;
return auto_bp_peering_enabled() && self()->connections.get_max_client_count() != 0 &&
established_client_connection(new_connection) && num_established_clients() > self()->connections.get_max_client_count();
}

// Only called from main thread
Expand All @@ -182,7 +182,7 @@ class bp_connection_manager {

fc_dlog(self()->get_logger(), "pending_downstream_neighbors: ${pending_downstream_neighbors}",
("pending_downstream_neighbors", to_string(pending_downstream_neighbors)));
for (auto neighbor : pending_downstream_neighbors) { self()->connect(config.bp_peer_addresses[neighbor]); }
for (auto neighbor : pending_downstream_neighbors) { self()->connections.connect(config.bp_peer_addresses[neighbor]); }

pending_neighbors = std::move(pending_downstream_neighbors);
finder.add_upstream_neighbors(pending_neighbors);
Expand Down Expand Up @@ -222,7 +222,7 @@ class bp_connection_manager {
std::back_inserter(peers_to_drop));
fc_dlog(self()->get_logger(), "peers to drop: ${peers_to_drop}", ("peers_to_drop", to_string(peers_to_drop)));

for (auto account : peers_to_drop) { self()->disconnect(config.bp_peer_addresses[account]); }
for (auto account : peers_to_drop) { self()->connections.disconnect(config.bp_peer_addresses[account]); }
active_schedule_version = schedule.version;
}
}
Expand Down
Loading