2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

drtio: make sure receive buffer is drained after ping reply

This commit is contained in:
Sebastien Bourdeauducq 2020-04-06 22:33:15 +08:00
parent ffd3172e02
commit facc0357d8

View File

@ -68,7 +68,17 @@ pub mod drtio {
}
let reply = aux_transact(io, aux_mutex, linkno, &drtioaux::Packet::EchoRequest);
match reply {
Ok(drtioaux::Packet::EchoReply) => return count,
Ok(drtioaux::Packet::EchoReply) => {
// make sure receive buffer is drained
let max_time = clock::get_ms() + 200;
loop {
if clock::get_ms() > max_time {
return count;
}
let _ = drtioaux::recv(linkno);
io.relinquish().unwrap();
}
}
_ => {}
}
io.relinquish().unwrap();