async fn attempt_reconnection(&mut self) -> Result<(), GatewayClientError> {
        info!("Attempting gateway reconnection...");
        self.authenticated = false;

        for i in 1..self.reconnection_attempts {
            info!("attempt {}...", i);
            if let Ok(_) = self.authenticate_and_start().await {
                info!("managed to reconnect!");
                return Ok(());
            }
            tokio::time::delay_for(self.reconnection_backoff).await;
        }

        // final attempt (done separately to be able to return a proper error)
        info!("attempt {}", self.reconnection_attempts);
        match self.authenticate_and_start().await {
            Ok(_) => {
                info!("managed to reconnect!");
                Ok(())
            }
            Err(err) => {
                error!(
                    "failed to reconnect after {} attempts",
                    self.reconnection_attempts
                );
                Err(err)
            }
        }
    }
// ignore the current socket state (with which we can't do much anyway)
// note: the caller MUST ensure that if the stream was delegated, the spawned
// future is finished.
ignore the current socket state (with which we can't do much anyway)
note: the caller MUST ensure that if the stream was delegated, the spawned
future is finished.
ignore the current socket state ( with which we can ' t do much anyway ) note : the caller MUST ensure that if the stream was delegated the spawned future is finished .
async fn attempt_reconnection(&mut self) -> Result<(), GatewayClientError> {
        info!("Attempting gateway reconnection...");
        self.authenticated = false;
        for i in 1..self.reconnection_attempts {
            info!("attempt {}...", i);
            if let Ok(_) = self.authenticate_and_start().await {
                info!("managed to reconnect!");
                return Ok(());
            }
            tokio::time::delay_for(self.reconnection_backoff).await;
        }
        // final attempt (done separately to be able to return a proper error)
        info!("attempt {}", self.reconnection_attempts);
        match self.authenticate_and_start().await {
            Ok(_) => {
                info!("managed to reconnect!");
                Ok(())
            }
            Err(err) => {
                error!(
                    "failed to reconnect after {} attempts",
                    self.reconnection_attempts
                );
                Err(err)
            }
        }
    }
async fn attempt_reconnection ( & mut self ) -> Result < ( ) , GatewayClientError > { info ! ( " " ) ; self . authenticated = false ; for i in 1 .. self . reconnection_attempts { info ! ( " " i ) ; if let Ok ( _ ) = self . authenticate_and_start ( ) . await { info ! ( " " ) ; return Ok ( ( ) ) ; } tokio :: time :: delay_for ( self . reconnection_backoff ) . await ; } // final attempt (done separately to be able to return a proper error) info ! ( " " self reconnection_attempts ) ; match self . authenticate_and_start ( ) . await { Ok ( _ ) => { info ! ( " " ) ; Ok ( ( ) ) } Err ( err ) => { error ! ( " " self reconnection_attempts ) ; Err ( err ) } } }
ignore the current socket state (with which we can't do much anyway)
note: the caller MUST ensure that if the stream was delegated, the spawned
future is finished.
ignore the current socket state ( with which we can ' t do much anyway ) note : the caller MUST ensure that if the stream was delegated the spawned future is finished .
&mut self