changeset 3863:9973d10bc5c4 transcoding

switch to DicomStoreUserConnection in Lua routing, C-MOVE handler and straight C-STORE
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 27 Apr 2020 18:16:20 +0200
parents 594263db316a
children ce5c4b9fa09a
files Core/DicomNetworking/TimeoutDicomConnectionManager.cpp Core/DicomNetworking/TimeoutDicomConnectionManager.h OrthancServer/OrthancMoveRequestHandler.cpp OrthancServer/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp OrthancServer/main.cpp
diffstat 6 files changed, 23 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp	Mon Apr 27 17:28:55 2020 +0200
+++ b/Core/DicomNetworking/TimeoutDicomConnectionManager.cpp	Mon Apr 27 18:16:20 2020 +0200
@@ -62,7 +62,7 @@
   }
 
   
-  DicomUserConnection& TimeoutDicomConnectionManager::Lock::GetConnection()
+  DicomStoreUserConnection& TimeoutDicomConnectionManager::Lock::GetConnection()
   {
     if (that_.connection_.get() == NULL)
     {
@@ -87,10 +87,12 @@
   void TimeoutDicomConnectionManager::OpenInternal(const std::string& localAet,
                                                    const RemoteModalityParameters& remote)
   {
+    DicomAssociationParameters other(localAet, remote);
+    
     if (connection_.get() == NULL ||
-        !connection_->IsSameAssociation(localAet, remote))
+        !connection_->GetParameters().IsEqual(other))
     {
-      connection_.reset(new DicomUserConnection(localAet, remote));
+      connection_.reset(new DicomStoreUserConnection(other));
     }
   }
 
@@ -101,7 +103,7 @@
     if (connection_.get() != NULL)
     {
       LOG(INFO) << "Closing inactive DICOM association with modality: "
-                << connection_->GetRemoteApplicationEntityTitle();
+                << connection_->GetParameters().GetRemoteApplicationEntityTitle();
 
       connection_.reset(NULL);
     }
--- a/Core/DicomNetworking/TimeoutDicomConnectionManager.h	Mon Apr 27 17:28:55 2020 +0200
+++ b/Core/DicomNetworking/TimeoutDicomConnectionManager.h	Mon Apr 27 18:16:20 2020 +0200
@@ -43,7 +43,7 @@
 
 
 #include "../Compatibility.h"
-#include "DicomUserConnection.h"
+#include "DicomStoreUserConnection.h"
 
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <boost/thread/mutex.hpp>
@@ -56,10 +56,10 @@
   class TimeoutDicomConnectionManager : public boost::noncopyable
   {
   private:
-    boost::mutex                          mutex_;
-    std::unique_ptr<DicomUserConnection>  connection_;
-    boost::posix_time::ptime              lastUse_;
-    boost::posix_time::time_duration      timeout_;
+    boost::mutex                               mutex_;
+    std::unique_ptr<DicomStoreUserConnection>  connection_;
+    boost::posix_time::ptime                   lastUse_;
+    boost::posix_time::time_duration           timeout_;
 
     // Mutex must be locked
     void TouchInternal();
@@ -85,7 +85,7 @@
       
       ~Lock();
 
-      DicomUserConnection& GetConnection();
+      DicomStoreUserConnection& GetConnection();
     };
 
     TimeoutDicomConnectionManager() :
--- a/OrthancServer/OrthancMoveRequestHandler.cpp	Mon Apr 27 17:28:55 2020 +0200
+++ b/OrthancServer/OrthancMoveRequestHandler.cpp	Mon Apr 27 18:16:20 2020 +0200
@@ -59,7 +59,7 @@
       RemoteModalityParameters remote_;
       std::string originatorAet_;
       uint16_t originatorId_;
-      std::unique_ptr<DicomUserConnection> connection_;
+      std::unique_ptr<DicomStoreUserConnection> connection_;
 
     public:
       SynchronousMove(ServerContext& context,
@@ -113,11 +113,14 @@
 
         if (connection_.get() == NULL)
         {
-          connection_.reset(new DicomUserConnection(localAet_, remote_));
+          connection_.reset(new DicomStoreUserConnection(localAet_, remote_));
         }
 
         std::string sopClassUid, sopInstanceUid;  // Unused
-        connection_->Store(sopClassUid, sopInstanceUid, dicom, originatorAet_, originatorId_);
+
+        const void* data = dicom.empty() ? NULL : dicom.c_str();
+        connection_->Store(sopClassUid, sopInstanceUid, data, dicom.size(),
+                           originatorAet_, originatorId_);
 
         return Status_Success;
       }
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Apr 27 17:28:55 2020 +0200
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Apr 27 18:16:20 2020 +0200
@@ -981,8 +981,7 @@
     RemoteModalityParameters remote =
       MyGetModalityUsingSymbolicName(call.GetUriComponent("id", ""));
 
-    DicomUserConnection connection(localAet, remote);
-    connection.Open();
+    DicomStoreUserConnection connection(localAet, remote);
 
     std::string sopClassUid, sopInstanceUid;
     connection.Store(sopClassUid, sopInstanceUid,
--- a/OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp	Mon Apr 27 17:28:55 2020 +0200
+++ b/OrthancServer/ServerJobs/Operations/StoreScuOperation.cpp	Mon Apr 27 18:16:20 2020 +0200
@@ -63,8 +63,10 @@
       std::string dicom;
       instance.ReadDicom(dicom);
 
+      const void* data = dicom.empty() ? NULL : dicom.c_str();
+      
       std::string sopClassUid, sopInstanceUid;  // Unused
-      lock.GetConnection().Store(sopClassUid, sopInstanceUid, dicom);
+      lock.GetConnection().Store(sopClassUid, sopInstanceUid, data, dicom.size());
     }
     catch (OrthancException& e)
     {
--- a/OrthancServer/main.cpp	Mon Apr 27 17:28:55 2020 +0200
+++ b/OrthancServer/main.cpp	Mon Apr 27 18:16:20 2020 +0200
@@ -1288,7 +1288,7 @@
     
     HttpClient::SetDefaultProxy(lock.GetConfiguration().GetStringParameter("HttpProxy", ""));
     
-    DicomUserConnection::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10));
+    DicomAssociationParameters::SetDefaultTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScuTimeout", 10));
 
     maxCompletedJobs = lock.GetConfiguration().GetUnsignedIntegerParameter("JobsHistorySize", 10);