async fn init_with_peer_limit<S>(
    peerset_initial_target_size: usize,
    inbound_service: S,
    network: Network,
) -> Arc<std::sync::Mutex<AddressBook>>
where
    S: Service<Request, Response = Response, Error = BoxError> + Clone + Send + 'static,
    S::Future: Send + 'static,
{
    // This test might fail on machines with no configured IPv4 addresses
    // (localhost should be enough).
    let unused_v4 = "0.0.0.0:0".parse().unwrap();

    let config = Config {
        peerset_initial_target_size,

        network,
        listen_addr: unused_v4,

        ..Config::default()
    };

    let (_peer_service, address_book) = init(config, inbound_service, NoChainTip).await;

    address_book
}
/// Initialize a peer set with `peerset_initial_target_size` and `inbound_service` on `network`.
/// Returns the newly created [`AddressBook`] for testing.
///
/// Binds the network listener to an unused port on all network interfaces.


Binds the network listener to an unused port on all network interfaces.
Binds the network listener to an unused port on all network interfaces .
async fn init_with_peer_limit<S>(
    peerset_initial_target_size: usize,
    inbound_service: S,
    network: Network,
) -> Arc<std::sync::Mutex<AddressBook>>
where
    S: Service<Request, Response = Response, Error = BoxError> + Clone + Send + 'static,
    S::Future: Send + 'static,
{
    // This test might fail on machines with no configured IPv4 addresses
    // (localhost should be enough).
    let unused_v4 = "0.0.0.0:0".parse().unwrap();
    let config = Config {
        peerset_initial_target_size,
        network,
        listen_addr: unused_v4,
        ..Config::default()
    };
    let (_peer_service, address_book) = init(config, inbound_service, NoChainTip).await;
    address_book
}
async fn init_with_peer_limit < S > ( peerset_initial_target_size : usize , inbound_service : S , network : Network , ) -> Arc < std :: sync :: Mutex < AddressBook > > where S : Service < Request , Response = Response , Error = BoxError > + Clone + Send + ' static , S :: Future : Send + ' static , { // This test might fail on machines with no configured IPv4 addresses // (localhost should be enough). let unused_v4 = " " . parse ( ) . unwrap ( ) ; let config = Config { peerset_initial_target_size , network , listen_addr : unused_v4 , .. Config :: default ( ) } ; let ( _peer_service , address_book ) = init ( config , inbound_service , NoChainTip ) . await ; address_book }
Initialize a peer set with `peerset_initial_target_size` and `inbound_service` on `network`.
Initialize a peer set with ` peerset_initial_target_size ` and ` inbound_service ` on ` network ` .
peerset_initial_target_size
usize
inbound_service
S
network
Network