|
@ -70,6 +70,7 @@ impl<S, R, E> Client<S, R, E> where |
|
|
fn send(&mut self, pkt: S) {
|
|
|
fn send(&mut self, pkt: S) {
|
|
|
println!("[send] {:?}", pkt);
|
|
|
println!("[send] {:?}", pkt);
|
|
|
let buf = pkt.as_bytes();
|
|
|
let buf = pkt.as_bytes();
|
|
|
|
|
|
println!("[send: buf] {:?}", buf);
|
|
|
let mut cbuf = self.cipher_out.encrypt(&buf).unwrap();
|
|
|
let mut cbuf = self.cipher_out.encrypt(&buf).unwrap();
|
|
|
self.send_buffer.append(&mut cbuf);
|
|
|
self.send_buffer.append(&mut cbuf);
|
|
|
self.send_data();
|
|
|
self.send_data();
|
|
@ -107,6 +108,7 @@ impl<S, R, E> Client<S, R, E> where |
|
|
Err(err) => {
|
|
|
Err(err) => {
|
|
|
match err {
|
|
|
match err {
|
|
|
PacketNetworkError::ClientDisconnected => self.running = false,
|
|
|
PacketNetworkError::ClientDisconnected => self.running = false,
|
|
|
|
|
|
PacketNetworkError::PacketParseError(err) => println!("undef pkt {:?}: {:?}", self.socket, err),
|
|
|
_ => {} //println!("error recv-ing packet with {:?}: {:?}", self.socket, err),
|
|
|
_ => {} //println!("error recv-ing packet with {:?}: {:?}", self.socket, err),
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
break;
|
|
|