# HG changeset patch # User Sebastien Jodogne # Date 1604508025 -3600 # Node ID 526bd8bad8509b5475b0926b451e5af6eb923cb0 # Parent 544120b34c093288d295218abcc03ba7aa29e5f1 debug logs for C-MOVE and C-GET SCP diff -r 544120b34c09 -r 526bd8bad850 OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp --- a/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp Wed Nov 04 16:27:59 2020 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/FindScp.cpp Wed Nov 04 17:40:25 2020 +0100 @@ -200,6 +200,7 @@ DcmDataset **responseIdentifiers, DcmDataset **statusDetail) { + assert(response != NULL); assert(requestIdentifiers != NULL); bzero(response, sizeof(T_DIMSE_C_FindRSP)); @@ -327,6 +328,16 @@ // There are pending results that are still to be sent response->DimseStatus = STATUS_Pending; *responseIdentifiers = data.answers_.ExtractDcmDataset(responseCount - 1); + + if (*responseIdentifiers) + { + std::stringstream s; // This is necessary for VS2008 + s << DcmObject::PrintHelper(**responseIdentifiers); + OFString str; + CLOG(TRACE, DICOM) << "Sending C-FIND Response " + << responseCount << "/" << data.answers_.GetSize() << ":" << std::endl + << s.str(); + } } else if (data.answers_.IsComplete()) { @@ -341,21 +352,6 @@ response->DimseStatus = STATUS_FIND_Cancel_MatchingTerminatedDueToCancelRequest; *responseIdentifiers = NULL; } - - { - OFString str; - CLOG(TRACE, DICOM) << "Sending C-FIND Response:" << std::endl - << DIMSE_dumpMessage(str, *response, DIMSE_OUTGOING); - } - - if (*responseIdentifiers) - { - std::stringstream s; // This is necessary for VS2008 - s << DcmObject::PrintHelper(**responseIdentifiers); - CLOG(TRACE, DICOM) << "C-FIND Response Content " - << responseCount << "/" << data.answers_.GetSize() << ":" << std::endl - << s.str(); - } } } diff -r 544120b34c09 -r 526bd8bad850 OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp --- a/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp Wed Nov 04 16:27:59 2020 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/GetScp.cpp Wed Nov 04 17:40:25 2020 +0100 @@ -195,6 +195,7 @@ { assert(response != NULL); assert(responseIdentifiers != NULL); + assert(requestIdentifiers != NULL); bzero(response, sizeof(T_DIMSE_C_GetRSP)); *statusDetail = NULL; @@ -203,6 +204,12 @@ GetScpData& data = *reinterpret_cast(callbackData); if (data.lastRequest_ == NULL) { + { + std::stringstream s; // This is necessary for VS2008 + s << DcmObject::PrintHelper(*requestIdentifiers); + /*CLOG(TRACE, DICOM)*/std::cout << "Received C-GET Request:" << std::endl << s.str(); + } + DicomMap input; std::set ignoreTagLength; FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */, ignoreTagLength); diff -r 544120b34c09 -r 526bd8bad850 OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp --- a/OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp Wed Nov 04 16:27:59 2020 +0100 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp Wed Nov 04 17:40:25 2020 +0100 @@ -158,6 +158,9 @@ DcmDataset **responseIdentifiers, DcmDataset **statusDetail) { + assert(response != NULL); + assert(requestIdentifiers != NULL); + bzero(response, sizeof(T_DIMSE_C_MoveRSP)); *statusDetail = NULL; *responseIdentifiers = NULL; @@ -165,6 +168,12 @@ MoveScpData& data = *reinterpret_cast(callbackData); if (data.lastRequest_ == NULL) { + { + std::stringstream s; // This is necessary for VS2008 + s << DcmObject::PrintHelper(*requestIdentifiers); + CLOG(TRACE, DICOM) << "Received C-MOVE Request:" << std::endl << s.str(); + } + DicomMap input; std::set ignoreTagLength; FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */, ignoreTagLength); diff -r 544120b34c09 -r 526bd8bad850 OrthancServer/Sources/OrthancGetRequestHandler.cpp --- a/OrthancServer/Sources/OrthancGetRequestHandler.cpp Wed Nov 04 16:27:59 2020 +0100 +++ b/OrthancServer/Sources/OrthancGetRequestHandler.cpp Wed Nov 04 17:40:25 2020 +0100 @@ -53,16 +53,16 @@ namespace Orthanc { - namespace + static void ProgressCallback(void *callbackData, + T_DIMSE_StoreProgress *progress, + T_DIMSE_C_StoreRQ *req) { - // Anonymous namespace to avoid clashes between compilation modules - - static void GetSubOpProgressCallback( - void * /* callbackData == pointer to the "OrthancGetRequestHandler" object */, - T_DIMSE_StoreProgress *progress, - T_DIMSE_C_StoreRQ * /*req*/) + if (req != NULL && + progress->state == DIMSE_StoreBegin) { - // SBL - no logging to be done here. + OFString str; + CLOG(TRACE, DICOM) << "Sending Store Request following a C-GET:" << std::endl + << DIMSE_dumpMessage(str, *req, DIMSE_OUTGOING); } } @@ -151,8 +151,8 @@ if (pc->result == ASC_P_ACCEPTANCE && LookupTransferSyntax(transferSyntax, pc->acceptedTransferSyntax)) { - CLOG(TRACE, DICOM) << "C-GET SCP accepted: SOP class " << sopClassUid - << " with transfer syntax " << GetTransferSyntaxUid(transferSyntax); + /*CLOG(TRACE, DICOM) << "C-GET SCP accepted: SOP class " << pc->abstractSyntax + << " with transfer syntax " << GetTransferSyntaxUid(transferSyntax);*/ if (std::string(pc->abstractSyntax) == sopClassUid) { accepted[transferSyntax] = pc->presentationContextID; @@ -311,7 +311,7 @@ DcmDataset *stDetailTmp = NULL; cond = DIMSE_storeUser( assoc, presId, &req, NULL /* imageFileName */, dicom->getDataset(), - GetSubOpProgressCallback, this /* callbackData */, + ProgressCallback, NULL /* callbackData */, (timeout_ > 0 ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout_, &rsp, &stDetailTmp, &cancelParameters); stDetail.reset(stDetailTmp); @@ -332,7 +332,7 @@ cond = DIMSE_storeUser( assoc, presId, &req, NULL /* imageFileName */, transcoded.GetParsed().getDataset(), - GetSubOpProgressCallback, this /* callbackData */, + ProgressCallback, NULL /* callbackData */, (timeout_ > 0 ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout_, &rsp, &stDetailTmp, &cancelParameters); stDetail.reset(stDetailTmp); @@ -353,6 +353,12 @@ if (cond.good()) { + { + OFString str; + CLOG(TRACE, DICOM) << "Received Store Response following a C-GET:" << std::endl + << DIMSE_dumpMessage(str, rsp, DIMSE_INCOMING); + } + if (cancelParameters.cancelEncountered) { LOG(INFO) << "C-GET SCP: Received C-Cancel RQ";