Browse Source

fix case where unknown packets caused the next packet to not be handled properly

pbs
jake 5 years ago
parent
commit
f8af4ab3a1
  1. 9
      src/common/client.rs

9
src/common/client.rs

@ -98,8 +98,13 @@ impl<S, R> Client<S, R> where
let pkt_data = self.incoming_data.drain(..pkt_len).collect::<Vec<_>>();
trace!("[recv buf from {:?}] {:?}", self.id, pkt_data);
let pkt = R::from_bytes(&pkt_data[..pkt_size])
.map_err(|err| -> PacketNetworkError { err.into() })?;
let pkt = match R::from_bytes(&pkt_data[..pkt_size]) {
Ok(p) => p,
Err(err) => {
warn!("error RecvServerPacket::from_bytes: {:?}", err);
continue
},
};
trace!("[recv from {:?}] {:?}", self.id, pkt);
result.push(pkt);

Loading…
Cancel
Save