Start topology task
@@ -46,6 +46,7 @@ pub mod start_up;
pub mod state;
mod stats_counter;
pub mod stuck_notifier;
+pub mod topology;
pub mod utils;
use stats_counter::StatsCounter;
@@ -77,6 +78,7 @@ const FRAGMENT_TASK_QUEUE_LEN: usize = 1024;
const NETWORK_TASK_QUEUE_LEN: usize = 32;
const EXPLORER_TASK_QUEUE_LEN: usize = 32;
const CLIENT_TASK_QUEUE_LEN: usize = 32;
+const TOPOLOGY_TASK_QUEUE_LEN: usize = 32;
const BOOTSTRAP_RETRY_WAIT: Duration = Duration::from_secs(5);
fn start_services(bootstrapped_node: BootstrappedNode) -> Result<(), start_up::Error> {
@@ -96,6 +98,7 @@ fn start_services(bootstrapped_node: BootstrappedNode) -> Result<(), start_up::E
let (block_msgbox, block_queue) = async_msg::channel(BLOCK_TASK_QUEUE_LEN);
let (fragment_msgbox, fragment_queue) = async_msg::channel(FRAGMENT_TASK_QUEUE_LEN);
let (client_msgbox, client_queue) = async_msg::channel(CLIENT_TASK_QUEUE_LEN);
+ let (topology_msgbox, topology_queue) = async_msg::channel(TOPOLOGY_TASK_QUEUE_LEN);
let blockchain_tip = bootstrapped_node.blockchain_tip;
let blockchain = bootstrapped_node.blockchain;
let leadership_logs =
@@ -175,18 +178,29 @@ fn start_services(bootstrapped_node: BootstrappedNode) -> Result<(), start_up::E
client_box: client_msgbox,
transaction_box: fragment_msgbox,
block_box: block_msgbox,
+ topology_box: topology_msgbox.clone(),
};
- services.spawn_future("network", move |info| {
+ services.spawn_future("network", move |_| {
let params = network::TaskParams {
global_state,
input: network_queue,
channels,
};
- network::start(info, params)
+ network::start(params)
});
}
+ {
+ let task_data = topology::TaskData {
+ config: bootstrapped_node.settings.network.clone(),
+ network_msgbox: network_msgbox.clone(),
+ topology_queue,
+ };
+
+ services.spawn_future("topology", move |info| topology::start(info, task_data));
+ }
+
let bft_leaders = block_on(async {
if let LeadershipConsensus::Bft(data) = blockchain_tip
.get_ref()
@@ -271,6 +285,7 @@ fn start_services(bootstrapped_node: BootstrappedNode) -> Result<(), start_up::E
stats_counter,
network_task: network_msgbox,
transaction_task: fragment_msgbox,
+ topology_task: topology_msgbox,
leadership_logs,
enclave,
network_state,
