From 8dd6fd4cb065b6596618c922ccd3f7a5b76246a0 Mon Sep 17 00:00:00 2001 From: Eduardo Pinho Date: Fri, 3 Nov 2023 22:21:56 +0000 Subject: [PATCH 1/2] [findscu] Add response status check in C-FIND-RSP fixes a situation where the SCU would wait eternally for more messages if the SCP sent a command set with pending status but then responded with 0 in the data set --- findscu/src/main.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/findscu/src/main.rs b/findscu/src/main.rs index 063514ce1..33b01e73f 100644 --- a/findscu/src/main.rs +++ b/findscu/src/main.rs @@ -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::() .whatever_context("failed to read status code")?; @@ -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 = cmd_obj + .get(tags::STATUS) + .whatever_context("status code from response is missing")? + .to_int::() + .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); From c0e2f4816efeb67922d8214816761cc8be6dc641 Mon Sep 17 00:00:00 2001 From: Eduardo Pinho Date: Mon, 6 Nov 2023 09:35:05 +0000 Subject: [PATCH 2/2] Update findscu/src/main.rs --- findscu/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/findscu/src/main.rs b/findscu/src/main.rs index 33b01e73f..0b176b5b0 100644 --- a/findscu/src/main.rs +++ b/findscu/src/main.rs @@ -322,7 +322,7 @@ fn run() -> Result<(), Error> { // check DICOM status, // as some implementations might report status code 0 // upon sending the response data - let status = cmd_obj + let status = dcm .get(tags::STATUS) .whatever_context("status code from response is missing")? .to_int::()