Skip to main content

queue_ready_candidate_demand

Function queue_ready_candidate_demand 

Source
async fn queue_ready_candidate_demand(
    address_book_service: &Buffer<BoxService<AddressBookRequest, AddressBookResponse, BoxError>, AddressBookRequest>,
    demand_tx: Sender<MorePeers>,
    spare_capacity: usize,
) -> usize
Expand description

Queue a dial attempt using demand_tx for each of the spare_capacity outbound slots that has a candidate ready to dial. Returns the number of ready candidates.

Capping the queued attempts at the ready candidate count avoids spawning fallback crawls for demand that can’t be met. The demand handler re-checks the connection limit before each handshake, so excess signals are dropped, and failed handshakes restore their demand signal.