fix protocol race condition

libnyx sends a ping packet twice during initialization which
can cause a synchronization problem with QEMU-Nyx
This commit is contained in:
Sergej Schumilo 2022-04-08 09:49:58 +02:00
parent c4b71a05c0
commit 3cceb0caae

View File

@ -172,7 +172,7 @@ impl QemuProcess {
thread::sleep(time::Duration::from_secs(1)); thread::sleep(time::Duration::from_secs(1));
thread::sleep(time::Duration::from_millis(200*params.qemu_id as u64)); thread::sleep(time::Duration::from_millis(200*params.qemu_id as u64));
let mut child = if params.dump_python_code_for_inputs{ let mut child = if params.dump_python_code_for_inputs{
Command::new(&params.cmd[0]) Command::new(&params.cmd[0])
@ -192,7 +192,7 @@ impl QemuProcess {
thread::sleep(time::Duration::from_secs(1)); thread::sleep(time::Duration::from_secs(1));
thread::sleep(time::Duration::from_millis(200*params.qemu_id as u64)); thread::sleep(time::Duration::from_millis(200*params.qemu_id as u64));
let mut control = loop { let mut control = loop {
match UnixStream::connect(&params.control_filename) { match UnixStream::connect(&params.control_filename) {
@ -203,7 +203,7 @@ impl QemuProcess {
} }
}; };
if run_qemu(&mut control).is_err() { if wait_qemu(&mut control).is_err() {
return Err(format!("cannot launch QEMU-Nyx...")); return Err(format!("cannot launch QEMU-Nyx..."));
} }