check magic in receive

This commit is contained in:
Hailey Somerville 2023-08-14 19:33:18 +10:00
parent 700afda7e6
commit df96bcaa68

View file

@ -67,6 +67,11 @@ impl Receiver {
}
pub fn push_packet(&mut self, packet: &Packet) {
if packet.magic != protocol::MAGIC {
eprintln!("ignoring packet with bad magic");
return;
}
if let Some(start) = self.start.as_mut() {
if packet.seq < start.seq {
eprintln!("received packet with seq before start, dropping");