- update: schema now sets the skills column to prevent a crash
- update: frontend to only pass the session id - update: launcher to pass the session correctly - update: validate session response now returns the session id and user id to the requester - update: auth client based on session id instead of a jwt token
This commit is contained in:
@@ -14,14 +14,18 @@ pub struct Packet {
|
||||
}
|
||||
|
||||
pub trait PacketPayload {
|
||||
fn encode(&self) -> Result<Vec<u8>, Box<dyn std::error::Error + Send + Sync>> where Self: Encode {
|
||||
fn encode(&self) -> Result<Vec<u8>, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
Self: Encode,
|
||||
{
|
||||
let config = bincode::config::standard().with_fixed_int_encoding();
|
||||
Ok(bincode::encode_to_vec(self, config)?)
|
||||
}
|
||||
|
||||
fn decode(data: &[u8]) -> Result<Self, Box<dyn std::error::Error + Send + Sync>>
|
||||
where
|
||||
Self: Sized, Self: Decode<()>
|
||||
Self: Sized,
|
||||
Self: Decode<()>,
|
||||
{
|
||||
let config = bincode::config::standard().with_fixed_int_encoding();
|
||||
Ok(bincode::decode_from_slice(data, config)?.0)
|
||||
@@ -107,7 +111,7 @@ impl Packet {
|
||||
|
||||
pub async fn send_packet(stream: &mut TcpStream, packet: &Packet) -> Result<(), std::io::Error> {
|
||||
let data = packet.to_raw();
|
||||
debug!("Sending data: {:?}", data);
|
||||
debug!("Sending '{:#X}' bytes of data. {:?}", data.len(), data);
|
||||
stream.write_all(&data).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user