fn pick_iterate_nodes<I>(
    unsorted_nodes: I,
    target_id: InfoHash,
) -> [(NodeHandle, bool); ITERATIVE_PICK_NUM]
where
    I: Iterator<Item = NodeHandle>,
{
    let dummy_id = [0u8; NODE_ID_LEN].into();
    let default = (
        NodeHandle::new(dummy_id, SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))),
        false,
    );

    let mut pick_nodes = [default; ITERATIVE_PICK_NUM];
    for node in unsorted_nodes {
        insert_closest_nodes(&mut pick_nodes, target_id, node);
    }

    pick_nodes
}
/// Picks a number of nodes from the unsorted distance iterator to ping on iterative rounds.
Picks a number of nodes from the unsorted distance iterator to ping on iterative rounds.
Picks a number of nodes from the unsorted distance iterator to ping on iterative rounds .
fn pick_iterate_nodes<I>(
    unsorted_nodes: I,
    target_id: InfoHash,
) -> [(NodeHandle, bool); ITERATIVE_PICK_NUM]
where
    I: Iterator<Item = NodeHandle>,
{
    let dummy_id = [0u8; NODE_ID_LEN].into();
    let default = (
        NodeHandle::new(dummy_id, SocketAddr::from((Ipv4Addr::UNSPECIFIED, 0))),
        false,
    );
    let mut pick_nodes = [default; ITERATIVE_PICK_NUM];
    for node in unsorted_nodes {
        insert_closest_nodes(&mut pick_nodes, target_id, node);
    }
    pick_nodes
}
fn pick_iterate_nodes < I > ( unsorted_nodes : I , target_id : InfoHash , ) -> [ ( NodeHandle , bool ) ; ITERATIVE_PICK_NUM ] where I : Iterator < Item = NodeHandle > , { let dummy_id = [ 0u8 ; NODE_ID_LEN ] . into ( ) ; let default = ( NodeHandle :: new ( dummy_id , SocketAddr :: from ( ( Ipv4Addr :: UNSPECIFIED , 0 ) ) ) , false , ) ; let mut pick_nodes = [ default ; ITERATIVE_PICK_NUM ] ; for node in unsorted_nodes { insert_closest_nodes ( & mut pick_nodes , target_id , node ) ; } pick_nodes }
Picks a number of nodes from the unsorted distance iterator to ping on iterative rounds.
Picks a number of nodes from the unsorted distance iterator to ping on iterative rounds .
unsorted_nodes
I
target_id
InfoHash
unsorted_nodes
I
target_id
InfoHash