Skip to content

Commit

Permalink
Merge pull request #434 from Enet4/imp/findscu/check-status-data
Browse files Browse the repository at this point in the history
[findscu] Add response status check in C-FIND-RSP response data set
  • Loading branch information
Enet4 authored Nov 9, 2023
2 parents 07a2310 + c0e2f48 commit 213ccab
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion findscu/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ fn run() -> Result<(), Error> {
.context(DumpOutputSnafu)?;
}
let status = cmd_obj
.element(tags::STATUS)
.get(tags::STATUS)
.whatever_context("status code from response is missing")?
.to_int::<u16>()
.whatever_context("failed to read status code")?;
Expand Down Expand Up @@ -318,6 +318,23 @@ fn run() -> Result<(), Error> {
DumpOptions::new()
.dump_object(&dcm)
.context(DumpOutputSnafu)?;

// check DICOM status,
// as some implementations might report status code 0
// upon sending the response data
let status = dcm
.get(tags::STATUS)
.whatever_context("status code from response is missing")?
.to_int::<u16>()
.whatever_context("failed to read status code")?;

if status == 0 {
if verbose {
debug!("Matching is complete");
}
break;
}

i += 1;
} else {
warn!("Operation failed (status code {})", status);
Expand Down

0 comments on commit 213ccab

Please sign in to comment.