B:BD[
3.2006] → [
2.2316:2463]
∅:D[
2.2463] → [
3.2143:2175]
B:BD[
3.2143] → [
3.2143:2175]
B:BD[
3.2175] → [
2.2464:2572]
∅:D[
2.2572] → [
3.2291:2314]
B:BD[
3.2291] → [
3.2291:2314]
let msg = &buf[..len];
match serde_json::from_slice(msg) {
Ok(events) => Some((events, addr)),
Err(e) => {
println!("{:?}: {}", e, String::from_utf8_lossy(msg));
None
},
let msg = str::from_utf8(&buf[..len]).unwrap();
let (id, events): (usize, Vec<io::Event>) = serde_json::from_str(msg).unwrap();
// Debug
println!("<= {}", msg);
let expected_id = self.in_packets.get();
if id < expected_id {
println!("^ old packet");
None
} else {
if id > expected_id {
println!("^ lost {} packets", id - expected_id)
}
self.in_packets.set(id + 1);
Some((events, addr))