Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions anchor/network/src/peer_manager/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ impl ConnectionManager {
return false;
}

// Don't dial connected peers
if self.connected.contains(peer_id) {
return false;
}

self.connected.len() < self.target_peers
|| self.qualifies_for_priority_connection(peer_id, peer_store, needed_subnets)
}
Expand Down
3 changes: 0 additions & 3 deletions anchor/network/src/peer_manager/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,10 @@ impl PeerDiscovery {
/// Track a subnet as needed and return actions to find peers for it
pub fn track_subnet_peers(
subnet_id: SubnetId,
needed_subnets: &mut HashSet<SubnetId>,
peer_store: &MemoryStore<Enr>,
connection_manager: &ConnectionManager,
blocked_peers: &HashSet<PeerId>,
) -> ConnectActions {
needed_subnets.insert(subnet_id);

Self::determine_actions_for_subnets(
Comment on lines 68 to 77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is unrelated?

&[subnet_id],
peer_store,
Expand Down
3 changes: 2 additions & 1 deletion anchor/network/src/peer_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ impl PeerManager {

/// Join subnet and dial peers for it
pub fn join_subnet(&mut self, subnet_id: SubnetId) -> ConnectActions {
self.needed_subnets.insert(subnet_id);

PeerDiscovery::track_subnet_peers(
subnet_id,
&mut self.needed_subnets,
self.peer_store.store(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

&self.connection_manager,
self.blocking_manager.blocked_peers(),
Expand Down
Loading