pub async fn initial_setup(self) -> Self {
        let mut client = self.get_and_update_topology().await;
        let gateway = client.choose_gateway();

        let (mixnet_messages_sender, mixnet_messages_receiver) = mpsc::unbounded();
        let (ack_sender, ack_receiver) = mpsc::unbounded();

        let mut gateway_client = GatewayClient::new(
            gateway.client_listener.clone(),
            Arc::clone(&client.identity),
            gateway.identity_key,
            None,
            mixnet_messages_sender,
            ack_sender,
            DEFAULT_GATEWAY_RESPONSE_TIMEOUT,
        );

        gateway_client
            .authenticate_and_start()
            .await
            .expect("could not authenticate and start up the gateway connection");

        client.gateway_client = Some(gateway_client);
        match client.on_gateway_connect.as_ref() {
            Some(callback) => {
                callback
                    .call0(&JsValue::null())
                    .expect("on connect callback failed!");
            }
            None => console_log!("Gateway connection established - no callback specified"),
        };

        let message_preparer = MessagePreparer::new(
            DEFAULT_RNG,
            client.self_recipient(),
            DEFAULT_AVERAGE_PACKET_DELAY,
            DEFAULT_AVERAGE_ACK_DELAY,
            DEFAULT_PACKET_MODE,
            Some(DEFAULT_VPN_KEY_REUSE_LIMIT),
        );

        let received_processor = ReceivedMessagesProcessor::new(
            Arc::clone(&client.encryption_keys),
            Arc::clone(&client.ack_key),
        );

        client.message_preparer = Some(message_preparer);

        spawn_local(received_processor.start_processing(
            mixnet_messages_receiver,
            ack_receiver,
            client.on_message.take().expect("on_message was not set!"),
        ));

        client
    }
// Right now it's impossible to have async exported functions to take `&self` rather than self
Right now it's impossible to have async exported functions to take `&self` rather than self
Right now it ' s impossible to have async exported functions to take ` &self ` rather than self
pub async fn initial_setup(self) -> Self {
        let mut client = self.get_and_update_topology().await;
        let gateway = client.choose_gateway();
        let (mixnet_messages_sender, mixnet_messages_receiver) = mpsc::unbounded();
        let (ack_sender, ack_receiver) = mpsc::unbounded();
        let mut gateway_client = GatewayClient::new(
            gateway.client_listener.clone(),
            Arc::clone(&client.identity),
            gateway.identity_key,
            None,
            mixnet_messages_sender,
            ack_sender,
            DEFAULT_GATEWAY_RESPONSE_TIMEOUT,
        );
        gateway_client
            .authenticate_and_start()
            .await
            .expect("could not authenticate and start up the gateway connection");
        client.gateway_client = Some(gateway_client);
        match client.on_gateway_connect.as_ref() {
            Some(callback) => {
                callback
                    .call0(&JsValue::null())
                    .expect("on connect callback failed!");
            }
            None => console_log!("Gateway connection established - no callback specified"),
        };
        let message_preparer = MessagePreparer::new(
            DEFAULT_RNG,
            client.self_recipient(),
            DEFAULT_AVERAGE_PACKET_DELAY,
            DEFAULT_AVERAGE_ACK_DELAY,
            DEFAULT_PACKET_MODE,
            Some(DEFAULT_VPN_KEY_REUSE_LIMIT),
        );
        let received_processor = ReceivedMessagesProcessor::new(
            Arc::clone(&client.encryption_keys),
            Arc::clone(&client.ack_key),
        );
        client.message_preparer = Some(message_preparer);
        spawn_local(received_processor.start_processing(
            mixnet_messages_receiver,
            ack_receiver,
            client.on_message.take().expect("on_message was not set!"),
        ));
        client
    }
pub async fn initial_setup ( self ) -> Self { let mut client = self . get_and_update_topology ( ) . await ; let gateway = client . choose_gateway ( ) ; let ( mixnet_messages_sender , mixnet_messages_receiver ) = mpsc :: unbounded ( ) ; let ( ack_sender , ack_receiver ) = mpsc :: unbounded ( ) ; let mut gateway_client = GatewayClient :: new ( gateway . client_listener . clone ( ) , Arc :: clone ( & client . identity ) , gateway . identity_key , None , mixnet_messages_sender , ack_sender , DEFAULT_GATEWAY_RESPONSE_TIMEOUT , ) ; gateway_client . authenticate_and_start ( ) . await . expect ( " " ) ; client . gateway_client = Some ( gateway_client ) ; match client . on_gateway_connect . as_ref ( ) { Some ( callback ) => { callback . call0 ( & JsValue :: null ( ) ) . expect ( " " ) ; } None => console_log ! ( " " ) , } ; let message_preparer = MessagePreparer :: new ( DEFAULT_RNG , client . self_recipient ( ) , DEFAULT_AVERAGE_PACKET_DELAY , DEFAULT_AVERAGE_ACK_DELAY , DEFAULT_PACKET_MODE , Some ( DEFAULT_VPN_KEY_REUSE_LIMIT ) , ) ; let received_processor = ReceivedMessagesProcessor :: new ( Arc :: clone ( & client . encryption_keys ) , Arc :: clone ( & client . ack_key ) , ) ; client . message_preparer = Some ( message_preparer ) ; spawn_local ( received_processor . start_processing ( mixnet_messages_receiver , ack_receiver , client . on_message . take ( ) . expect ( " " ) , ) ) ; client }
Right now it's impossible to have async exported functions to take `&self` rather than self
Right now it ' s impossible to have async exported functions to take ` &self ` rather than self
self