From 1dd9568c924ede2b46fa40ea8f7eed03a2ffba1c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 20 Sep 2015 12:54:12 +0100 Subject: [PATCH] Modified ETag system to make it more stable. --- source/common/etag.cpp | 24 ++++++++++++++++++++++++ source/common/etag.h | 1 + 2 files changed, 25 insertions(+) diff --git a/source/common/etag.cpp b/source/common/etag.cpp index 95e38e4..e4dcef1 100644 --- a/source/common/etag.cpp +++ b/source/common/etag.cpp @@ -106,6 +106,30 @@ void ETagDB::UpdateETag(wxString Filename, wxString ETag, wxString ETagOriginal) } +bool ETagDB::ETagExists(wxString Filename){ + + // Lock or wait if it is already locked. + + ProcessLock->lock(); + + bool FileResult = FALSE; + + if (FilenameETag.find(Filename) != FilenameETag.end()){ + + FileResult = TRUE; + + } else { + + FileResult = FALSE; + + } + + // Unlock. + + ProcessLock->unlock(); + +} + std::map* ETagDB::GetFilenamePointer(){ return &FilenameETag; diff --git a/source/common/etag.h b/source/common/etag.h index b81af16..097db40 100644 --- a/source/common/etag.h +++ b/source/common/etag.h @@ -33,6 +33,7 @@ public: wxString GetETag(wxString Filename); wxString GetETagOriginal(wxString Filename); bool CheckETagExists(wxString Filename); + bool ETagExists(wxString Filename); //boost::mutex ProcessLock; // ETagDB functions. -- 2.39.5