I am trying to set up a test environment for my application's DICOM communication. To this end, I start a thread that runs an instance of DcmQueryRetrieveSCP. At the end of all test runs this thread needs be terminated, which I am trying to do with the private shutdown SOP. However, this causes a crash in DcmQueryRetrieveSCP.
I looked at the issue in the debugger and found the following: DcmQueryRetrieveSCP::waitForAssociation() calls negotiateAssociation(), which detects the shutdown SOP and calls refuseAssocitaion:
Code: Select all
/*
* check if we have negotiated the private "shutdown" SOP Class
*/
if (0 != ASC_findAcceptedPresentationContextID(assoc, UID_PrivateShutdownSOPClass))
{
DCMQRDB_INFO("Shutting down server ... (negotiated private \"shut down\" SOP class)");
refuseAssociation(&assoc, CTN_NoReason);
return ASC_SHUTDOWNAPPLICATION;
}
Code: Select all
cond = ASC_rejectAssociation(*assoc, &rej);
if (cond.bad())
{
DCMQRDB_ERROR("Association Reject Failed: " << DimseCondition::dump(temp_str, cond));
}
cond = ASC_dropAssociation(*assoc);
if (cond.bad())
{
DCMQRDB_ERROR("Cannot Drop Association: " << DimseCondition::dump(temp_str, cond));
}
cond = ASC_destroyAssociation(assoc);
if (cond.bad())
{
DCMQRDB_ERROR("Cannot Destroy Association: " << DimseCondition::dump(temp_str, cond));
}
Code: Select all
// clean-up association
OFCondition oldcond = cond; /* store condition flag for later use */
cond = ASC_dropAssociation(assoc);
if (cond.bad())
{
DCMQRDB_ERROR("Cannot Drop Association: " << DimseCondition::dump(temp_str, cond));
}
cond = ASC_destroyAssociation(&assoc);
if (cond.bad())
{
DCMQRDB_ERROR("Cannot Destroy Association: " << DimseCondition::dump(temp_str, cond));
}
Any help would be appreciated!