mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 06:48:43 -06:00
add kick reason
This commit is contained in:
parent
eff0b50546
commit
c1f1ec028f
|
@ -139,9 +139,10 @@ impl<S, R> Client<S, R> where S: Encode + Decode, R: Encode + Decode {
|
||||||
self.status = ClientStatus::Connected;
|
self.status = ClientStatus::Connected;
|
||||||
return Ok(())
|
return Ok(())
|
||||||
},
|
},
|
||||||
ServerPacket::Disconnected => {
|
ServerPacket::Disconnected(reason) => {
|
||||||
//this should never fail but we're handling the error anyway
|
//this should never fail but we're handling the error anyway
|
||||||
self.disconnect_inner(DisconnectReason::KickedByServer, true)?;
|
let reason = DisconnectReason::KickedByServer(reason);
|
||||||
|
self.disconnect_inner(reason, true)?;
|
||||||
return Ok(())
|
return Ok(())
|
||||||
},
|
},
|
||||||
ServerPacket::Data(message) => {
|
ServerPacket::Data(message) => {
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub enum DisconnectReason {
|
||||||
#[default]
|
#[default]
|
||||||
NotConnected,
|
NotConnected,
|
||||||
ClientDisconnected,
|
ClientDisconnected,
|
||||||
KickedByServer,
|
KickedByServer(String),
|
||||||
ClientTimeout,
|
ClientTimeout,
|
||||||
ServerTimeout,
|
ServerTimeout,
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub struct IdClientPacket<T: Encode + Decode>(pub Option<ClientId>, pub ClientPa
|
||||||
pub enum ServerPacket<T> where T: Encode + Decode {
|
pub enum ServerPacket<T> where T: Encode + Decode {
|
||||||
Data(T),
|
Data(T),
|
||||||
Connected(ClientId),
|
Connected(ClientId),
|
||||||
Disconnected,
|
Disconnected(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Encode, Decode)]
|
#[derive(Encode, Decode)]
|
||||||
|
|
Loading…
Reference in a new issue