Skip to main content

wait_for_peer

Function wait_for_peer 

Source
pub async fn wait_for_peer<C: IpcClient + ?Sized>(
    client: &C,
    destination: Endpoint,
    cancellation_token: Option<CancellationToken>,
) -> Result<DiscoverResponse, RequestError>
Expand description

Waits until destination answers a DiscoverRequest, retrying until it does or cancellation_token is cancelled.

Use this before sending to a peer that may not have started yet. An error answer from the peer, such as having no discover handler, is returned without retrying, since the peer is up. A subscribe error, such as the local client not running, is also returned without retrying.