Mercurial > hg > orthanc-transfers
comparison 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 |
comparison
equal
deleted
inserted
replaced
40:1256194e1c08 | 41:eb6edb022a00 |
---|---|
18 | 18 |
19 | 19 |
20 #include "OrthancInstancesCache.h" | 20 #include "OrthancInstancesCache.h" |
21 | 21 |
22 #include <Compatibility.h> // For std::unique_ptr | 22 #include <Compatibility.h> // For std::unique_ptr |
23 #include <Logging.h> | |
23 | 24 |
24 namespace OrthancPlugins | 25 namespace OrthancPlugins |
25 { | 26 { |
26 void OrthancInstancesCache::CacheAccessor::CheckValid() const | 27 void OrthancInstancesCache::CacheAccessor::CheckValid() const |
27 { | 28 { |
244 // Check whether the instance is part of the cache | 245 // Check whether the instance is part of the cache |
245 { | 246 { |
246 CacheAccessor accessor(*this, instanceId); | 247 CacheAccessor accessor(*this, instanceId); |
247 if (accessor.IsValid()) | 248 if (accessor.IsValid()) |
248 { | 249 { |
250 // keeping this log for future (see TODO) LOG(INFO) << "++++ Chunk for " << instanceId << " is in cache"; | |
249 accessor.GetChunk(chunk, md5, offset, size); | 251 accessor.GetChunk(chunk, md5, offset, size); |
250 return; | 252 return; |
251 } | 253 } |
252 } | 254 } |
253 | 255 |
254 // The instance was not in the cache, load it | 256 // The instance was not in the cache, load it |
255 std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId)); | 257 std::unique_ptr<SourceDicomInstance> instance(new SourceDicomInstance(instanceId)); |
256 instance->GetChunk(chunk, md5, 0, instance->GetInfo().GetSize()); | 258 instance->GetChunk(chunk, md5, offset, size); |
257 | 259 |
258 // Store the just-loaded DICOM instance into the cache | 260 // Store the just-loaded DICOM instance into the cache |
259 { | 261 { |
262 // keeping this log for future (see TODO) LOG(ERROR) << "---- Chunk for " << instanceId << " not in cache -> adding it"; | |
260 boost::mutex::scoped_lock lock(mutex_); | 263 boost::mutex::scoped_lock lock(mutex_); |
261 Store(instanceId, instance); | 264 Store(instanceId, instance); |
262 } | 265 } |
263 } | 266 } |
264 | 267 |