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

Use async/await instead of manual polling of NetworkWorker #2127

Closed
wants to merge 10 commits into from
6 changes: 4 additions & 2 deletions client/relay-chain-minimal-node/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub(crate) fn build_collator_network(
.to_vec(),
};

let network_worker = sc_network::NetworkWorker::new(network_params)?;
let mut network_worker = sc_network::NetworkWorker::new(network_params)?;
let network_service = network_worker.service().clone();

let (network_start_tx, network_start_rx) = futures::channel::oneshot::channel();
Expand All @@ -127,7 +127,9 @@ pub(crate) fn build_collator_network(
return
}

network_worker.await
loop {
network_worker.next_action().await;
}
});

let network_starter = NetworkStarter::new(network_start_tx);
Expand Down