diff OrthancServer/QueryRetrieveHandler.cpp @ 2590:5e2730c8e23c jobs

getting rid of ReusableDicomConnection in QueryRetrieveHandler and OrthancMoveRequestHandler
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 15 May 2018 16:28:43 +0200
parents 878b59270859
children 6f9225dcfc32
line wrap: on
line diff
--- a/OrthancServer/QueryRetrieveHandler.cpp	Tue May 15 16:10:03 2018 +0200
+++ b/OrthancServer/QueryRetrieveHandler.cpp	Tue May 15 16:28:43 2018 +0200
@@ -76,6 +76,19 @@
   {
     done_ = false;
     answers_.Clear();
+    connection_.reset(NULL);
+  }
+
+
+  DicomUserConnection& QueryRetrieveHandler::GetConnection()
+  {
+    if (connection_.get() == NULL)
+    {
+      connection_.reset(new DicomUserConnection(localAet_, modality_));
+      connection_->Open();
+    }
+
+    return *connection_;
   }
 
 
@@ -91,11 +104,7 @@
       // Secondly, possibly fix the query with the user-provider Lua callback
       FixQuery(fixed, context_, modality_.GetApplicationEntityTitle()); 
 
-      {
-        // Finally, run the C-FIND SCU against the fixed query
-        ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
-        locker.GetConnection().Find(answers_, level_, fixed);
-      }
+      GetConnection().Find(answers_, level_, fixed);
 
       done_ = true;
     }
@@ -155,11 +164,7 @@
   {
     DicomMap map;
     GetAnswer(map, i);
-
-    {
-      ReusableDicomUserConnection::Locker locker(context_.GetReusableDicomUserConnection(), localAet_, modality_);
-      locker.GetConnection().Move(target, map);
-    }
+    GetConnection().Move(target, map);
   }