diff --git a/kubi-udp/src/client.rs b/kubi-udp/src/client.rs index 4bddda6..55d0917 100644 --- a/kubi-udp/src/client.rs +++ b/kubi-udp/src/client.rs @@ -139,9 +139,10 @@ impl Client where S: Encode + Decode, R: Encode + Decode { self.status = ClientStatus::Connected; return Ok(()) }, - ServerPacket::Disconnected => { + ServerPacket::Disconnected(reason) => { //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(()) }, ServerPacket::Data(message) => { diff --git a/kubi-udp/src/common.rs b/kubi-udp/src/common.rs index ec4b097..83a40ef 100644 --- a/kubi-udp/src/common.rs +++ b/kubi-udp/src/common.rs @@ -9,7 +9,7 @@ pub enum DisconnectReason { #[default] NotConnected, ClientDisconnected, - KickedByServer, + KickedByServer(String), ClientTimeout, ServerTimeout, } diff --git a/kubi-udp/src/packet.rs b/kubi-udp/src/packet.rs index d824d2c..8f13403 100644 --- a/kubi-udp/src/packet.rs +++ b/kubi-udp/src/packet.rs @@ -18,7 +18,7 @@ pub struct IdClientPacket(pub Option, pub ClientPa pub enum ServerPacket where T: Encode + Decode { Data(T), Connected(ClientId), - Disconnected, + Disconnected(String), } #[derive(Encode, Decode)]