Skip to content

Commit

Permalink
Fix reception of data sets spanning several PDVs
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Dec 15, 2015
1 parent 6c94486 commit 1fa6656
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/dcmtkpp/ServiceRole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -306,8 +308,6 @@ ServiceRole::_receive_dataset(
*/
stream.write(reinterpret_cast<char *>(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
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down

0 comments on commit 1fa6656

Please sign in to comment.