diff options
Diffstat (limited to 'client/src/network.rs')
-rw-r--r-- | client/src/network.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/client/src/network.rs b/client/src/network.rs index e542c7e..e54ecf7 100644 --- a/client/src/network.rs +++ b/client/src/network.rs @@ -7,7 +7,7 @@ use std::{ use anyhow::Result; use log::{debug, info, warn}; -use weareshared::packets::Packet; +use weareshared::packets::{Packet, ReadWrite}; pub struct Network { pub packet_recv: Receiver<Packet>, @@ -40,7 +40,7 @@ impl Network { fn handle_conn_read(sock: TcpStream, tx: Sender<Packet>) -> Result<()> { let mut sock = BufReader::new(sock); loop { - let packet = Packet::deserialize(&mut sock)?; + let packet = Packet::read(&mut sock)?; debug!("<- {packet:?}"); tx.send(packet)?; } @@ -49,7 +49,7 @@ fn handle_conn_write(sock: TcpStream, rx: Receiver<Packet>) -> Result<()> { let mut sock = BufWriter::new(sock); for packet in rx { debug!("-> {packet:?}"); - packet.serialize(&mut sock)?; + packet.write(&mut sock)?; sock.flush()?; } Ok(()) |