pub(crate) fn reset_state(&mut self, permanent_err: Option<OssuaryError>) {
        self.local_key = OssuaryConnection::generate_session_material().unwrap_or_default();
        self.remote_key = None;
        self.local_msg_id = 0;
        self.remote_msg_id = 0;
        self.remote_auth = Default::default();
        self.read_buf = [0u8; PACKET_BUF_SIZE];
        self.read_buf_used = 0;
        self.write_buf = [0u8; PACKET_BUF_SIZE];
        self.write_buf_used = 0;
        self.reset_count += 1;
        let perm_error = match self.reset_count {
            c if c < MAX_RESET_COUNT => permanent_err,
            _ => Some(OssuaryError::ConnectionFailed),
        };
        self.state = match perm_error {
            None => ConnectionState::Resetting(true),
            Some(e) => ConnectionState::Failing(e),
        };
    }
/// Reset the context back to its default state.
///
/// If `permanent_err` is None, this connection can be re-established by
/// calling the connection handshake functions.  This indicates that
/// something unexpected went wrong with the connection, such as an invalid
/// state or corrupt data, such that reestablishing the connection may fix
/// it.
///
/// If `permanent_err` is set to some error, it indicates a permanent
/// failure on this connection, and attempting to reestablish it will likely
/// not work.  This includes situations where the server has rejected the
/// connection, such as when the client's key is not authorized.
///
Reset the context back to its default state.
If `permanent_err` is None, this connection can be re-established by
calling the connection handshake functions.  This indicates that
something unexpected went wrong with the connection, such as an invalid
state or corrupt data, such that reestablishing the connection may fix
it.

If `permanent_err` is set to some error, it indicates a permanent
failure on this connection, and attempting to reestablish it will likely
not work.  This includes situations where the server has rejected the
connection, such as when the client's key is not authorized.
Reset the context back to its default state . If ` permanent_err ` is None this connection can be re - established by calling the connection handshake functions . This indicates that something unexpected went wrong with the connection such as an invalid state or corrupt data such that reestablishing the connection may fix it . If ` permanent_err ` is set to some error it indicates a permanent failure on this connection and attempting to reestablish it will likely not work . This includes situations where the server has rejected the connection such as when the client ' s key is not authorized .
pub(crate) fn reset_state(&mut self, permanent_err: Option<OssuaryError>) {
        self.local_key = OssuaryConnection::generate_session_material().unwrap_or_default();
        self.remote_key = None;
        self.local_msg_id = 0;
        self.remote_msg_id = 0;
        self.remote_auth = Default::default();
        self.read_buf = [0u8; PACKET_BUF_SIZE];
        self.read_buf_used = 0;
        self.write_buf = [0u8; PACKET_BUF_SIZE];
        self.write_buf_used = 0;
        self.reset_count += 1;
        let perm_error = match self.reset_count {
            c if c < MAX_RESET_COUNT => permanent_err,
            _ => Some(OssuaryError::ConnectionFailed),
        };
        self.state = match perm_error {
            None => ConnectionState::Resetting(true),
            Some(e) => ConnectionState::Failing(e),
        };
    }
pub ( crate ) fn reset_state ( & mut self , permanent_err : Option < OssuaryError > ) { self . local_key = OssuaryConnection :: generate_session_material ( ) . unwrap_or_default ( ) ; self . remote_key = None ; self . local_msg_id = 0 ; self . remote_msg_id = 0 ; self . remote_auth = Default :: default ( ) ; self . read_buf = [ 0u8 ; PACKET_BUF_SIZE ] ; self . read_buf_used = 0 ; self . write_buf = [ 0u8 ; PACKET_BUF_SIZE ] ; self . write_buf_used = 0 ; self . reset_count += 1 ; let perm_error = match self . reset_count { c if c < MAX_RESET_COUNT => permanent_err , _ => Some ( OssuaryError :: ConnectionFailed ) , } ; self . state = match perm_error { None => ConnectionState :: Resetting ( true ) , Some ( e ) => ConnectionState :: Failing ( e ) , } ; }
Reset the context back to its default state.
Reset the context back to its default state .
&mut self
permanent_err
Option<OssuaryError>
&mut self
permanent_err
Option<OssuaryError>