Ignore known but unused packets

This commit is contained in:
Roderick van Domburg 2021-06-23 21:26:52 +02:00
parent 12365ae082
commit aa4cc0bee6
No known key found for this signature in database
GPG key ID: 7076AA781B43EFE6

View file

@ -203,25 +203,29 @@ impl Session {
self.debug_info(); self.debug_info();
self.send_packet(Pong, vec![0, 0, 0, 0]); self.send_packet(Pong, vec![0, 0, 0, 0]);
} }
Some(PongAck) => {}
Some(CountryCode) => { Some(CountryCode) => {
let country = String::from_utf8(data.as_ref().to_owned()).unwrap(); let country = String::from_utf8(data.as_ref().to_owned()).unwrap();
info!("Country: {:?}", country); info!("Country: {:?}", country);
self.0.data.write().unwrap().country = country; self.0.data.write().unwrap().country = country;
} }
Some(StreamChunkRes) | Some(ChannelError) => { Some(StreamChunkRes) | Some(ChannelError) => {
self.channel().dispatch(packet_type.unwrap(), data) self.channel().dispatch(packet_type.unwrap(), data);
} }
Some(AesKey) | Some(AesKeyError) => { Some(AesKey) | Some(AesKeyError) => {
self.audio_key().dispatch(packet_type.unwrap(), data) self.audio_key().dispatch(packet_type.unwrap(), data);
} }
Some(MercuryReq) | Some(MercurySub) | Some(MercuryUnsub) | Some(MercuryEvent) => { Some(MercuryReq) | Some(MercurySub) | Some(MercuryUnsub) | Some(MercuryEvent) => {
self.mercury().dispatch(packet_type.unwrap(), data) self.mercury().dispatch(packet_type.unwrap(), data);
} }
Some(PongAck)
| Some(SecretBlock)
| Some(LegacyWelcome)
| Some(UnknownDataAllZeros)
| Some(ProductInfo)
| Some(LicenseVersion) => {}
_ => { _ => {
if let Some(packet_type) = PacketType::from_u8(cmd) { if let Some(packet_type) = PacketType::from_u8(cmd) {
trace!("Ignoring {:?} packet", packet_type); trace!("Ignoring {:?} packet with data {:?}", packet_type, data);
} else { } else {
trace!("Ignoring unknown packet {:x}", cmd); trace!("Ignoring unknown packet {:x}", cmd);
} }