fixed a few bugs in internal directory storage structure

This commit is contained in:
mr-alice 2016-08-16 13:46:55 +02:00
parent 2668b6da1c
commit ca8f95c7f7
5 changed files with 59 additions and 24 deletions

View file

@ -12,7 +12,9 @@ static const uint32_t MAX_INACTIVITY_SLEEP_TIME = 2*1000*1000;
HashStorage::HashStorage(const std::string& save_file_name)
: mFilePath(save_file_name), mHashMtx("Hash Storage mutex")
{
mInactivitySleepTime = DEFAULT_INACTIVITY_SLEEP_TIME;
mRunning = false ;
load() ;
}
@ -63,7 +65,11 @@ void HashStorage::data_tick()
}
mInactivitySleepTime = DEFAULT_INACTIVITY_SLEEP_TIME;
job = mFilesToHash.begin()->second ;
{
RS_STACK_MUTEX(mHashMtx) ;
job = mFilesToHash.begin()->second ;
mFilesToHash.erase(mFilesToHash.begin()) ;
}
std::cerr << "Hashing file " << job.full_path << "..." ; std::cerr.flush();
@ -77,8 +83,6 @@ void HashStorage::data_tick()
else
std::cerr << "done."<< std::endl;
mFilesToHash.erase(mFilesToHash.begin()) ;
// store the result
HashStorageInfo& info(mFiles[job.full_path]);