pub enum ConnectionState {
Connecting,
Connected,
TimingOut,
Disconnecting,
Disconnected,
Unidentified,
Identified,
Offline,
}
Expand description
Connection States These are all possible states of a raknet session, and while accessible externally Please note that these are not states relied on within the original implementation of raknet, which preserve both “Unconnected” and “Connected”
Variants§
Connecting
The Session is not yet connected, but is actively trying to connect. Clients in this state are considered to be actively trying to connect.
Connected
The Session is connected and ready to send and receive packets. This is the state after a connection has been established.
This state is applied once the ConnectionHandshake
has been completed.
TimingOut
The session is being timed out because it has not sent a packet in a while. The interval for this can be set in the Session Options.
Disconnecting
The session has been disconnected but is still in the process of cleaning up. This is the state after a disconnect has been requested, but the client still wants to send packets until its done.
Disconnected
The session has been disconnected and is ready to be removed. This is the state after a disconnect has been requested and the client has This is almost never used.
Unidentified
The session is replying to the server but is not actually connected. This is the state where ping and pong packets are being sent. Similarly, this is the “Unconnected” state, hence “UnconnectedPing”
Identified
The session has been identified and is ready to be connected. This is the state after a connection has been established.
Offline
The session is not connected and is not trying to connect.
During this state the session will be dropped. This state occurs when a client
has completely stopped responding to packets or their socket is destroyed.
This is not the same as the Disconnected
state.
Implementations§
Source§impl ConnectionState
impl ConnectionState
Sourcepub fn is_reliable(&self) -> bool
pub fn is_reliable(&self) -> bool
Returns whether or not the Session is reliable. Reliable sessions are sessions that are not:
- Offline
- Disconnected
- TimingOut
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Returns whether or not the Session is available to recieve packets. Sessions in this state are:
- Connected
- Connecting
- Unidentified
- Disconnecting
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns whether or not the Session is in any “connected” state. Sessions in this state are:
- Connected
- Connecting
Trait Implementations§
Source§impl Clone for ConnectionState
impl Clone for ConnectionState
Source§fn clone(&self) -> ConnectionState
fn clone(&self) -> ConnectionState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more