Skip to content

Commit

Permalink
Update uechopost not to wait when the specified request message does …
Browse files Browse the repository at this point in the history
…not require the response messages
  • Loading branch information
cybergarage committed Dec 9, 2022
1 parent f35fbe0 commit dd93271
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions examples/uechopost/uechopost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,25 @@ fn main() {
continue;
}

let rx = ctrl.post_message(&node, &mut req_msg);
match rx.recv_timeout(Duration::from_secs(1)) {
Ok(res_msg) => {
println!("{}", res_msg);
match req_msg.esv() {
Esv::WriteRequest | Esv::NotificationRequest => {
ctrl.send_message(&node, &mut req_msg);
}
Err(e) => {
eprintln!("{}", e);
Esv::WriteRequestResponseRequired | Esv::ReadRequest | Esv::WriteReadRequest => {
let rx = ctrl.post_message(&node, &mut req_msg);
match rx.recv_timeout(Duration::from_secs(1)) {
Ok(res_msg) => {
println!("{}", res_msg);
}
Err(e) => {
eprintln!("{}", e);
}
};
}
};
_ => {
eprintln!("ESV ({:X}) is not request", req_msg.esv() as u8);
}
}

ctrl.stop();
return;
Expand Down

0 comments on commit dd93271

Please sign in to comment.