From 377392b8bd2000bed15175a2be26a50bc6a332fc Mon Sep 17 00:00:00 2001 From: Jake Probst Date: Tue, 20 Aug 2019 18:01:27 -0700 Subject: [PATCH] client uses mio tcpsocket --- src/common/client.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common/client.rs b/src/common/client.rs index 727fdc9..3369f0e 100644 --- a/src/common/client.rs +++ b/src/common/client.rs @@ -19,10 +19,10 @@ pub struct Client { } impl Client { - pub fn new(socket: net::TcpStream, state: Box>) -> Client { + pub fn new(socket: mio::tcp::TcpStream, state: Box>) -> Client { let mut client = Client { running: true, - socket: mio::tcp::TcpStream::from_stream(socket).expect("could not convert socket to nonblocking"), + socket: socket, cipher_in: Box::new(NullCipher {}), cipher_out: Box::new(NullCipher {}), state: state, @@ -62,7 +62,6 @@ impl Client { // TODO: this may need to pad to 8 bytes for bb cipher fn send(&mut self, pkt: &dyn PSOPacket) { let buf = pkt.as_bytes(); - println!("[send]: {:X?}", buf); let mut cbuf = self.cipher_out.encrypt(&buf).unwrap(); self.send_buffer.append(&mut cbuf); self.send_data(); @@ -97,7 +96,6 @@ impl Client { } }, Err(err) => { - println!("error recv-ing packet with {:?}: {:?}", self.socket, err); match err { PacketNetworkError::ClientDisconnected => self.running = false, _ => println!("error recv-ing packet with {:?}: {:?}", self.socket, err),