diff Core/DicomNetworking/DicomUserConnection.cpp @ 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 56f2397f027a
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 - "