diff Framework/OrthancInstancesCache.cpp @ 41:eb6edb022a00

fix transfer error
author Alain Mazy <am@osimis.io>
date Tue, 12 Jul 2022 15:07:31 +0200
parents 44a0430d7899
children 1e396fb509ca
line wrap: on
line diff
--- a/Framework/OrthancInstancesCache.cpp	Tue Jul 12 12:43:43 2022 +0200
+++ b/Framework/OrthancInstancesCache.cpp	Tue Jul 12 15:07:31 2022 +0200
@@ -20,6 +20,7 @@
 #include "OrthancInstancesCache.h"
 
 #include <Compatibility.h>  // For std::unique_ptr
+#include <Logging.h>
 
 namespace OrthancPlugins
 {
@@ -246,6 +247,7 @@
       CacheAccessor accessor(*this, instanceId);
       if (accessor.IsValid())
       {
+        // keeping this log for future (see TODO) LOG(INFO) << "++++ Chunk for " << instanceId << " is in cache";
         accessor.GetChunk(chunk, md5, offset, size);
         return;
       }
@@ -253,10 +255,11 @@
       
     // The instance was not in the cache, load it
     std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId));
-    instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize());
+    instance->GetChunk(chunk, md5, offset, size);
 
     // Store the just-loaded DICOM instance into the cache
     {
+      // keeping this log for future (see TODO) LOG(ERROR) << "---- Chunk for " << instanceId << " not in cache -> adding it";
       boost::mutex::scoped_lock lock(mutex_);
       Store(instanceId, instance);
     }