|
|
@ -133,7 +133,7 @@ bool CDatabaseStatus::getFileStatus(CFileStatus &fileStatus, const std::string &
|
|
|
|
bool seemsValid = false;
|
|
|
|
bool seemsValid = false;
|
|
|
|
std::string stdPath = unMacroPath(filePath);
|
|
|
|
std::string stdPath = unMacroPath(filePath);
|
|
|
|
std::string statusPath = getStatusFilePath(filePath);
|
|
|
|
std::string statusPath = getStatusFilePath(filePath);
|
|
|
|
m_StatusMutex.enterReader();
|
|
|
|
m_StatusMutex.lock_shared();
|
|
|
|
if (CFile::fileExists(statusPath))
|
|
|
|
if (CFile::fileExists(statusPath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CIFile ifs(statusPath, false);
|
|
|
|
CIFile ifs(statusPath, false);
|
|
|
@ -153,7 +153,7 @@ bool CDatabaseStatus::getFileStatus(CFileStatus &fileStatus, const std::string &
|
|
|
|
fileStatus.LastUpdate = 0;
|
|
|
|
fileStatus.LastUpdate = 0;
|
|
|
|
fileStatus.CRC32 = 0;
|
|
|
|
fileStatus.CRC32 = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_StatusMutex.leaveReader();
|
|
|
|
m_StatusMutex.unlock_shared();
|
|
|
|
return seemsValid;
|
|
|
|
return seemsValid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -167,7 +167,7 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
TFileStatusCallback Callback;
|
|
|
|
TFileStatusCallback Callback;
|
|
|
|
std::string FilePath; // Standardized!
|
|
|
|
std::string FilePath; // Standardized!
|
|
|
|
CReaderWriter *StatusMutex;
|
|
|
|
boost::shared_mutex *StatusMutex;
|
|
|
|
|
|
|
|
|
|
|
|
virtual void run()
|
|
|
|
virtual void run()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -178,7 +178,7 @@ public:
|
|
|
|
uint32 time = CTime::getSecondsSince1970();
|
|
|
|
uint32 time = CTime::getSecondsSince1970();
|
|
|
|
uint32 fmdt = CFile::getFileModificationDate(FilePath);
|
|
|
|
uint32 fmdt = CFile::getFileModificationDate(FilePath);
|
|
|
|
std::string statusPath = getStatusFilePath(FilePath); // g_PipelineDirectory + PIPELINE_DATABASE_STATUS_SUBDIR + dropDatabaseDirectory(FilePath) + ".status";
|
|
|
|
std::string statusPath = getStatusFilePath(FilePath); // g_PipelineDirectory + PIPELINE_DATABASE_STATUS_SUBDIR + dropDatabaseDirectory(FilePath) + ".status";
|
|
|
|
StatusMutex->enterReader();
|
|
|
|
StatusMutex->lock_shared();
|
|
|
|
if (CFile::fileExists(statusPath))
|
|
|
|
if (CFile::fileExists(statusPath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
CIFile ifs(statusPath, false);
|
|
|
|
CIFile ifs(statusPath, false);
|
|
|
@ -191,7 +191,7 @@ public:
|
|
|
|
fs.LastChangedReference = 0;
|
|
|
|
fs.LastChangedReference = 0;
|
|
|
|
fs.LastFileSizeReference = ~0;
|
|
|
|
fs.LastFileSizeReference = ~0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusMutex->leaveReader();
|
|
|
|
StatusMutex->unlock_shared();
|
|
|
|
if (fs.LastChangedReference == fmdt && fs.LastFileSizeReference == CFile::getFileSize(FilePath))
|
|
|
|
if (fs.LastChangedReference == fmdt && fs.LastFileSizeReference == CFile::getFileSize(FilePath))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlinfo("Skipping already updated status, may have been queued twice (%s)", FilePath.c_str());
|
|
|
|
nlinfo("Skipping already updated status, may have been queued twice (%s)", FilePath.c_str());
|
|
|
@ -228,14 +228,14 @@ public:
|
|
|
|
fs.LastFileSizeReference = fisz;
|
|
|
|
fs.LastFileSizeReference = fisz;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StatusMutex->enterWriter();
|
|
|
|
StatusMutex->lock();
|
|
|
|
{
|
|
|
|
{
|
|
|
|
COFile ofs(statusPath, false, false, true);
|
|
|
|
COFile ofs(statusPath, false, false, true);
|
|
|
|
fs.serial(ofs);
|
|
|
|
fs.serial(ofs);
|
|
|
|
ofs.flush();
|
|
|
|
ofs.flush();
|
|
|
|
ofs.close();
|
|
|
|
ofs.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusMutex->leaveWriter();
|
|
|
|
StatusMutex->unlock();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Callback(FilePath, fs, true);
|
|
|
|
Callback(FilePath, fs, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|