# HG changeset patch # User Sebastien Jodogne # Date 1582802669 -3600 # Node ID bd34b6ac5c0871e92872302f8a0aa3702ea7bbee # Parent d8b214a46b913992606a3ba062f7be7a9cbe86be timeouts in storage commitment SCU and SCP diff -r d8b214a46b91 -r bd34b6ac5c08 Core/DicomNetworking/DicomUserConnection.cpp --- a/Core/DicomNetworking/DicomUserConnection.cpp Thu Feb 27 12:07:19 2020 +0100 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Thu Feb 27 12:24:29 2020 +0100 @@ -1619,9 +1619,11 @@ { T_ASC_PresentationContextID presID = 0; T_DIMSE_Message message; - - if (!DIMSE_receiveCommand(pimpl_->assoc_, DIMSE_NONBLOCKING, 1, &presID, - &message, NULL /* no statusDetail */).good() || + + const int timeout = pimpl_->dimseTimeout_; + if (!DIMSE_receiveCommand(pimpl_->assoc_, + (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, + &presID, &message, NULL /* no statusDetail */).good() || message.CommandField != DIMSE_N_EVENT_REPORT_RSP) { throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " @@ -1750,8 +1752,10 @@ T_ASC_PresentationContextID presID = 0; T_DIMSE_Message message; - if (!DIMSE_receiveCommand(pimpl_->assoc_, DIMSE_NONBLOCKING, 1, &presID, - &message, NULL /* no statusDetail */).good() || + const int timeout = pimpl_->dimseTimeout_; + if (!DIMSE_receiveCommand(pimpl_->assoc_, + (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, + &presID, &message, NULL /* no statusDetail */).good() || message.CommandField != DIMSE_N_ACTION_RSP) { throw OrthancException(ErrorCode_NetworkProtocol, "Storage commitment - " diff -r d8b214a46b91 -r bd34b6ac5c08 Core/DicomNetworking/Internals/CommandDispatcher.cpp --- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp Thu Feb 27 12:07:19 2020 +0100 +++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp Thu Feb 27 12:24:29 2020 +0100 @@ -891,14 +891,15 @@ static DcmDataset* ReadDataset(T_ASC_Association* assoc, - const char* errorMessage) + const char* errorMessage, + int timeout) { DcmDataset *tmp = NULL; T_ASC_PresentationContextID presIdData; OFCondition cond = DIMSE_receiveDataSetInMemory( - assoc, /*opt_blockMode*/ DIMSE_BLOCKING, - /*opt_dimse_timeout*/ 0, &presIdData, &tmp, NULL, NULL); + assoc, (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout, + &presIdData, &tmp, NULL, NULL); if (!cond.good() || tmp == NULL) { @@ -1027,7 +1028,7 @@ **/ std::auto_ptr dataset( - ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP")); + ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP", associationTimeout_)); std::string transactionUid = ReadString(*dataset, DCM_TransactionUID); @@ -1150,7 +1151,7 @@ **/ std::auto_ptr dataset( - ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP")); + ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP", associationTimeout_)); std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);