diff OrthancServer/DicomProtocol/DicomServer.cpp @ 2069:fabf7820d1f1

New configuration options: "DicomScuTimeout" and "DicomScpTimeout" + validation of non-negative options
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jul 2016 16:52:39 +0200
parents 879f3be759ef
children 5a8840920121
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Wed Jul 13 16:10:25 2016 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Wed Jul 13 16:52:39 2016 +0200
@@ -121,10 +121,13 @@
     return port_;
   }
 
-  void DicomServer::SetAssociationTimeout(uint32_t timeout)
+  void DicomServer::SetAssociationTimeout(uint32_t seconds)
   {
+    LOG(INFO) << "Setting timeout for DICOM connections if Orthanc acts as SCP (server): " 
+              << seconds << " seconds (0 = no timeout)";
+
     Stop();
-    associationTimeout_ = timeout;
+    associationTimeout_ = seconds;
   }
 
   uint32_t DicomServer::GetAssociationTimeout() const
@@ -296,15 +299,9 @@
   {
     Stop();
 
-    uint32_t timeout = associationTimeout_;
-    if (timeout == 0)
-    {
-      timeout = 30;  // Some safe value (30 seconds) if association timeout is disabled
-    }
-
     /* initialize network, i.e. create an instance of T_ASC_Network*. */
     OFCondition cond = ASC_initializeNetwork
-      (NET_ACCEPTOR, OFstatic_cast(int, port_), /*opt_acse_timeout*/ timeout, &pimpl_->network_);
+      (NET_ACCEPTOR, OFstatic_cast(int, port_), /*opt_acse_timeout*/ 30, &pimpl_->network_);
     if (cond.bad())
     {
       LOG(ERROR) << "cannot create network: " << cond.text();