Skip to main content

wait_for_bootstrap_complete

Function wait_for_bootstrap_complete 

Source
pub async fn wait_for_bootstrap_complete(
    dht_events: Receiver<DhtNetworkEvent>,
    timeout_secs: u64,
    shutdown: &CancellationToken,
) -> BootstrapGateResult
Expand description

Wait for saorsa-core’s DhtNetworkEvent::BootstrapComplete before returning.

The caller must supply a pre-subscribed dht_events receiver. This is critical: the subscription must be created before P2PNode::start() so the BootstrapComplete event is not missed.

Returns BootstrapGateResult::Received on success, BootstrapGateResult::TimedOut if the timeout elapses (e.g. a bootstrap node with no peers), or BootstrapGateResult::Shutdown if cancellation is signalled.