Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Use a Kademlia instance per ProtocolId. (#5045)
Browse files Browse the repository at this point in the history
  • Loading branch information
twittner authored Apr 16, 2020
1 parent 2051ecb commit 710722f
Show file tree
Hide file tree
Showing 3 changed files with 358 additions and 199 deletions.
17 changes: 4 additions & 13 deletions client/network/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use crate::{
config::Role,
debug_info, discovery::DiscoveryBehaviour, discovery::DiscoveryOut,
debug_info, discovery::{DiscoveryBehaviour, DiscoveryConfig, DiscoveryOut},
Event, ObservedRole, DhtEvent, ExHashT,
};
use crate::protocol::{self, light_client_handler, message::Roles, CustomMessageOutcome, Protocol};
Expand Down Expand Up @@ -67,28 +67,19 @@ pub enum BehaviourOut<B: BlockT> {

impl<B: BlockT, H: ExHashT> Behaviour<B, H> {
/// Builds a new `Behaviour`.
pub async fn new(
pub fn new(
substrate: Protocol<B, H>,
role: Role,
user_agent: String,
local_public_key: PublicKey,
known_addresses: Vec<(PeerId, Multiaddr)>,
enable_mdns: bool,
allow_private_ipv4: bool,
discovery_only_if_under_num: u64,
block_requests: protocol::BlockRequests<B>,
light_client_handler: protocol::LightClientHandler<B>,
disco_config: DiscoveryConfig,
) -> Self {
Behaviour {
substrate,
debug_info: debug_info::DebugInfoBehaviour::new(user_agent, local_public_key.clone()),
discovery: DiscoveryBehaviour::new(
local_public_key,
known_addresses,
enable_mdns,
allow_private_ipv4,
discovery_only_if_under_num,
).await,
discovery: disco_config.finish(),
block_requests,
light_client_handler,
events: Vec::new(),
Expand Down
Loading

0 comments on commit 710722f

Please sign in to comment.