diff Framework/Oracle/ThreadedOracle.cpp @ 765:f6438fdc447e

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 May 2019 14:57:52 +0200
parents 1181e1ad98ec
children a68cd7ae8838
line wrap: on
line diff
--- a/Framework/Oracle/ThreadedOracle.cpp	Thu May 23 12:54:10 2019 +0200
+++ b/Framework/Oracle/ThreadedOracle.cpp	Thu May 23 14:57:52 2019 +0200
@@ -204,6 +204,9 @@
           
       Orthanc::GzipCompressor compressor;
       compressor.Uncompress(answer, compressed.c_str(), compressed.size());
+
+      LOG(INFO) << "Uncompressing gzip Encoding: from " << compressed.size()
+                << " to " << answer.size() << " bytes";
     }
   }
 
@@ -424,6 +427,29 @@
   }
 
 
+  ThreadedOracle::~ThreadedOracle()
+  {
+    if (state_ == State_Running)
+    {
+      LOG(ERROR) << "The threaded oracle is still running, explicit call to "
+                 << "Stop() is mandatory to avoid crashes";
+    }
+
+    try
+    {
+      StopInternal();
+    }
+    catch (Orthanc::OrthancException& e)
+    {
+      LOG(ERROR) << "Exception while stopping the threaded oracle: " << e.What();
+    }
+    catch (...)
+    {
+      LOG(ERROR) << "Native exception while stopping the threaded oracle";
+    }           
+  }
+
+  
   void ThreadedOracle::SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc)
   {
     boost::mutex::scoped_lock lock(mutex_);