changeset 2068:879f3be759ef

renames to make code clearer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 13 Jul 2016 16:10:25 +0200
parents 02c543c42e61
children fabf7820d1f1
files OrthancServer/DicomProtocol/DicomServer.cpp OrthancServer/DicomProtocol/DicomServer.h OrthancServer/Internals/CommandDispatcher.cpp OrthancServer/Internals/CommandDispatcher.h
diffstat 4 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Wed Jul 13 15:55:50 2016 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Wed Jul 13 16:10:25 2016 +0200
@@ -97,7 +97,7 @@
     worklistRequestHandlerFactory_ = NULL;
     applicationEntityFilter_ = NULL;
     checkCalledAet_ = true;
-    clientTimeout_ = 30;
+    associationTimeout_ = 30;
     continue_ = false;
   }
 
@@ -121,15 +121,15 @@
     return port_;
   }
 
-  void DicomServer::SetClientTimeout(uint32_t timeout)
+  void DicomServer::SetAssociationTimeout(uint32_t timeout)
   {
     Stop();
-    clientTimeout_ = timeout;
+    associationTimeout_ = timeout;
   }
 
-  uint32_t DicomServer::GetClientTimeout() const
+  uint32_t DicomServer::GetAssociationTimeout() const
   {
-    return clientTimeout_;
+    return associationTimeout_;
   }
 
 
@@ -296,9 +296,15 @@
   {
     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*/ 30, &pimpl_->network_);
+      (NET_ACCEPTOR, OFstatic_cast(int, port_), /*opt_acse_timeout*/ timeout, &pimpl_->network_);
     if (cond.bad())
     {
       LOG(ERROR) << "cannot create network: " << cond.text();
--- a/OrthancServer/DicomProtocol/DicomServer.h	Wed Jul 13 15:55:50 2016 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.h	Wed Jul 13 16:10:25 2016 +0200
@@ -54,7 +54,7 @@
     std::string aet_;
     uint16_t port_;
     bool continue_;
-    uint32_t clientTimeout_;
+    uint32_t associationTimeout_;
     IFindRequestHandlerFactory* findRequestHandlerFactory_;
     IMoveRequestHandlerFactory* moveRequestHandlerFactory_;
     IStoreRequestHandlerFactory* storeRequestHandlerFactory_;
@@ -71,8 +71,8 @@
     void SetPortNumber(uint16_t port);
     uint16_t GetPortNumber() const;
 
-    void SetClientTimeout(uint32_t timeout);
-    uint32_t GetClientTimeout() const;
+    void SetAssociationTimeout(uint32_t timeout);
+    uint32_t GetAssociationTimeout() const;
 
     void SetCalledApplicationEntityTitleCheck(bool check);
     bool HasCalledApplicationEntityTitleCheck() const;
--- a/OrthancServer/Internals/CommandDispatcher.cpp	Wed Jul 13 15:55:50 2016 +0200
+++ b/OrthancServer/Internals/CommandDispatcher.cpp	Wed Jul 13 16:10:25 2016 +0200
@@ -727,16 +727,16 @@
       else if (cond == DIMSE_NODATAAVAILABLE)
       {
         // Timeout due to DIMSE_NONBLOCKING
-        if (clientTimeout_ != 0 && 
-            elapsedTimeSinceLastCommand_ >= clientTimeout_)
+        if (associationTimeout_ != 0 && 
+            elapsedTimeSinceLastCommand_ >= associationTimeout_)
         {
-          // This timeout is actually a client timeout
+          // This timeout is actually a association timeout
           finished = true;
         }
       }
       else if (cond == EC_Normal)
       {
-        // Reset the client timeout counter
+        // Reset the association timeout counter
         elapsedTimeSinceLastCommand_ = 0;
 
         // Convert the type of request to Orthanc's internal type
--- a/OrthancServer/Internals/CommandDispatcher.h	Wed Jul 13 15:55:50 2016 +0200
+++ b/OrthancServer/Internals/CommandDispatcher.h	Wed Jul 13 16:10:25 2016 +0200
@@ -46,7 +46,7 @@
     class CommandDispatcher : public IRunnableBySteps
     {
     private:
-      uint32_t clientTimeout_;
+      uint32_t associationTimeout_;
       uint32_t elapsedTimeSinceLastCommand_;
       const DicomServer& server_;
       T_ASC_Association* assoc_;
@@ -69,7 +69,7 @@
         calledAet_(calledAet),
         filter_(filter)
       {
-        clientTimeout_ = server.GetClientTimeout();
+        associationTimeout_ = server.GetAssociationTimeout();
         elapsedTimeSinceLastCommand_ = 0;
       }