diff Core/DicomNetworking/DicomUserConnection.cpp @ 3704:58f92b1c8061

Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Feb 2020 11:25:57 +0100
parents 5cbbf14e516b
children d8b214a46b91 2a170a8f1faf
line wrap: on
line diff
--- a/Core/DicomNetworking/DicomUserConnection.cpp	Wed Feb 26 14:36:42 2020 +0100
+++ b/Core/DicomNetworking/DicomUserConnection.cpp	Thu Feb 27 11:25:57 2020 +0100
@@ -426,7 +426,8 @@
     DcmDataset* statusDetail = NULL;
     Check(DIMSE_storeUser(assoc_, presID, &request,
                           NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL,
-                          /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_,
+                          /*opt_blockMode*/ (dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
+                          /*opt_dimse_timeout*/ dimseTimeout_,
                           &response, &statusDetail, NULL),
           connection.remoteAet_, "C-STORE");
 
@@ -660,7 +661,7 @@
 				      responseCount,
 #endif
                                       FindCallback, &payload,
-                                      /*opt_blockMode*/ DIMSE_BLOCKING, 
+                                      /*opt_blockMode*/ (dimseTimeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
                                       /*opt_dimse_timeout*/ dimseTimeout,
                                       &response, &statusDetail);
 
@@ -858,7 +859,7 @@
     DcmDataset* responseIdentifiers = NULL;
     OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset,
                                       NULL, NULL,
-                                      /*opt_blockMode*/ DIMSE_BLOCKING, 
+                                      /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
                                       /*opt_dimse_timeout*/ pimpl_->dimseTimeout_,
                                       pimpl_->net_, NULL, NULL,
                                       &response, &statusDetail, &responseIdentifiers);
@@ -1168,7 +1169,7 @@
     CheckIsOpen();
     DIC_US status;
     Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, 
-                         /*opt_blockMode*/ DIMSE_BLOCKING, 
+                         /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
                          /*opt_dimse_timeout*/ pimpl_->dimseTimeout_,
                          &status, NULL), remoteAet_, "C-ECHO");
     return status == STATUS_Success;
@@ -1288,7 +1289,7 @@
     {
       dcmConnectionTimeout.set(seconds);
       pimpl_->dimseTimeout_ = seconds;
-      pimpl_->acseTimeout_ = 10;  // Timeout used during association negociation
+      pimpl_->acseTimeout_ = seconds;  // Timeout used during association negociation and ASC_releaseAssociation()
     }
   }
 
@@ -1301,7 +1302,7 @@
      */
     dcmConnectionTimeout.set(-1);
     pimpl_->dimseTimeout_ = 0;
-    pimpl_->acseTimeout_ = 10;  // Timeout used during association negociation
+    pimpl_->acseTimeout_ = 10;  // Timeout used during association negociation and ASC_releaseAssociation()
   }