Skip to content

Commit

Permalink
Wait for matching request id
Browse files Browse the repository at this point in the history
  • Loading branch information
Fanda Vacek committed Sep 5, 2024
1 parent 941b0bf commit c24ea0c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,9 +378,14 @@ async fn make_call(mut frame_reader: BoxedFrameReader, mut frame_writer: BoxedFr
method = method[ix + 1..].to_owned();
}
let param = opts.param.clone().unwrap_or_default();
send_request(&mut *frame_writer, &path, &method, &param).await?;
let resp = frame_reader.receive_message().await?;
print_resp(&mut stdout, &resp, (&*opts.output_format).into()).await?;
let rqid = send_request(&mut *frame_writer, &path, &method, &param).await?;
loop {
let resp = frame_reader.receive_message().await?;
if resp.request_id().unwrap_or_default() == rqid {
print_resp(&mut stdout, &resp, (&*opts.output_format).into()).await?;
break
}
}
}

Ok(())
Expand Down

0 comments on commit c24ea0c

Please sign in to comment.