forked from M-Labs/artiq
drtio: make sure receive buffer is drained after ping reply
This commit is contained in:
parent
8839101085
commit
5168b83158
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue