diff Framework/Oracle/ThreadedOracle.cpp @ 775:cf1102295ae5

Merge from default
author Benjamin Golinvaux <bgo@osimis.io>
date Fri, 24 May 2019 16:00:24 +0200
parents f6438fdc447e
children a68cd7ae8838
line wrap: on
line diff
--- a/Framework/Oracle/ThreadedOracle.cpp	Fri May 24 15:59:51 2019 +0200
+++ b/Framework/Oracle/ThreadedOracle.cpp	Fri May 24 16:00:24 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_);