fn with_builder(builder: DhtBuilder, socket: Socket) -> Self {
        let (command_tx, command_rx) = mpsc::unbounded_channel();

        // TODO: Utilize the security extension.
        let routing_table = RoutingTable::new(builder.node_id.unwrap_or_else(rand::random));
        let handler = DhtHandler::new(
            routing_table,
            socket,
            builder.read_only,
            builder.announce_port,
            command_rx,
        );

        if command_tx
            .send(OneshotTask::StartBootstrap(builder.routers, builder.nodes))
            .is_err()
        {
            // `unreachable` is OK here because the corresponding receiver definitely exists at
            // this point inside `handler`.
            unreachable!()
        }

        task::spawn(handler.run());

        Self { send: command_tx }
    }
/// Start the MainlineDht with the given DhtBuilder.
Start the MainlineDht with the given DhtBuilder.
Start the MainlineDht with the given DhtBuilder .
fn with_builder(builder: DhtBuilder, socket: Socket) -> Self {
        let (command_tx, command_rx) = mpsc::unbounded_channel();
        // TODO: Utilize the security extension.
        let routing_table = RoutingTable::new(builder.node_id.unwrap_or_else(rand::random));
        let handler = DhtHandler::new(
            routing_table,
            socket,
            builder.read_only,
            builder.announce_port,
            command_rx,
        );
        if command_tx
            .send(OneshotTask::StartBootstrap(builder.routers, builder.nodes))
            .is_err()
        {
            // `unreachable` is OK here because the corresponding receiver definitely exists at
            // this point inside `handler`.
            unreachable!()
        }
        task::spawn(handler.run());
        Self { send: command_tx }
    }
fn with_builder ( builder : DhtBuilder , socket : Socket ) -> Self { let ( command_tx , command_rx ) = mpsc :: unbounded_channel ( ) ; // TODO: Utilize the security extension. let routing_table = RoutingTable :: new ( builder . node_id . unwrap_or_else ( rand :: random ) ) ; let handler = DhtHandler :: new ( routing_table , socket , builder . read_only , builder . announce_port , command_rx , ) ; if command_tx . send ( OneshotTask :: StartBootstrap ( builder . routers , builder . nodes ) ) . is_err ( ) { // `unreachable` is OK here because the corresponding receiver definitely exists at // this point inside `handler`. unreachable ! ( ) } task :: spawn ( handler . run ( ) ) ; Self { send : command_tx } }
Start the MainlineDht with the given DhtBuilder.
Start the MainlineDht with the given DhtBuilder .
builder
DhtBuilder
socket
Socket
builder
DhtBuilder
socket
Socket