Mercurial > hg > orthanc
changeset 3706:bd34b6ac5c08 storage-commitment
timeouts in storage commitment SCU and SCP
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Feb 2020 12:24:29 +0100 |
parents | d8b214a46b91 |
children | bf8f17f23c26 |
files | Core/DicomNetworking/DicomUserConnection.cpp Core/DicomNetworking/Internals/CommandDispatcher.cpp |
diffstat | 2 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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 - "
--- 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<DcmDataset> 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<DcmDataset> 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);