From 1fa665669fa822593e6a7d0cd07af441845f26f4 Mon Sep 17 00:00:00 2001 From: Julien Lamy Date: Tue, 15 Dec 2015 10:24:40 +0100 Subject: [PATCH] Fix reception of data sets spanning several PDVs --- src/dcmtkpp/ServiceRole.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/dcmtkpp/ServiceRole.cpp b/src/dcmtkpp/ServiceRole.cpp index c187c02e..18b29ff0 100644 --- a/src/dcmtkpp/ServiceRole.cpp +++ b/src/dcmtkpp/ServiceRole.cpp @@ -262,6 +262,8 @@ ServiceRole::_receive_dataset( DataSet data_set; std::stringstream stream; + std::string transfer_syntax; + bool keep_group_length; /* start a loop in which we want to read a DIMSE command from the incoming socket stream. */ /* Since the command could stretch over more than one PDU, the use of a loop is mandatory. */ @@ -306,8 +308,6 @@ ServiceRole::_receive_dataset( */ stream.write(reinterpret_cast(pdv.data), pdv.fragmentLength); - std::string transfer_syntax; - bool keep_group_length; if(pdv.pdvType == DUL_COMMANDPDV) { /* DIMSE commands are always specified in the little endian implicit @@ -338,9 +338,6 @@ ServiceRole::_receive_dataset( throw Exception("Unknown PDV type"); } - Reader reader(stream, transfer_syntax, keep_group_length); - data_set = reader.read_data_set(); - /* update the following variables which will be evaluated at the beginning of each loop iteration. */ last = pdv.lastPDV; type = pdv.pdvType; @@ -351,6 +348,9 @@ ServiceRole::_receive_dataset( pdvCount++; } + Reader reader(stream, transfer_syntax, keep_group_length); + data_set = reader.read_data_set(); + return std::make_pair(data_set, type); }