mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
attempt at fixing the re-hash bug. Now only using canonicalized filenames in hash cache
This commit is contained in:
parent
22942dc70b
commit
d61a5cd5ab
@ -191,9 +191,9 @@ void HashStorage::data_tick()
|
||||
#endif
|
||||
|
||||
RS_STACK_MUTEX(mHashMtx) ;
|
||||
HashStorageInfo& info(mFiles[job.full_path]);
|
||||
HashStorageInfo& info(mFiles[job.real_path]);
|
||||
|
||||
info.filename = job.full_path ;
|
||||
info.filename = job.real_path ;
|
||||
info.size = size ;
|
||||
info.modf_stamp = job.ts ;
|
||||
info.time_stamp = time(NULL);
|
||||
@ -219,7 +219,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
// check if the hash is up to date w.r.t. cache.
|
||||
|
||||
#ifdef HASHSTORAGE_DEBUG
|
||||
std::cerr << "HASH Requested for file " << full_path << ": ";
|
||||
std::cerr << "HASH Requested for file " << full_path << ": mod_time: " << mod_time << ", size: " << size << " :" ;
|
||||
#endif
|
||||
RS_STACK_MUTEX(mHashMtx) ;
|
||||
|
||||
@ -272,6 +272,7 @@ bool HashStorage::requestHash(const std::string& full_path,uint64_t size,time_t
|
||||
job.size = size ;
|
||||
job.client_param = client_param ;
|
||||
job.full_path = full_path ;
|
||||
job.real_path = real_path ;
|
||||
job.ts = mod_time ;
|
||||
|
||||
// We store the files indexed by their real path, so that we allow to not re-hash files that are pointed multiple times through the directory links
|
||||
@ -443,7 +444,7 @@ bool HashStorage::writeHashStorageInfo(unsigned char *& data,uint32_t& total_si
|
||||
|
||||
std::ostream& operator<<(std::ostream& o,const HashStorage::HashStorageInfo& info)
|
||||
{
|
||||
return o << info.hash << " " << info.size << " " << info.filename ;
|
||||
return o << info.hash << " " << info.modf_stamp << " " << info.size << " " << info.filename ;
|
||||
}
|
||||
|
||||
/********************************************************************************************************************************/
|
||||
|
@ -118,7 +118,8 @@ private:
|
||||
|
||||
struct FileHashJob
|
||||
{
|
||||
std::string full_path;
|
||||
std::string full_path; // canonicalized file name (means: symlinks removed, loops removed, etc)
|
||||
std::string real_path; // path supplied by the client.
|
||||
uint64_t size ;
|
||||
HashStorageClient *client;
|
||||
uint32_t client_param ;
|
||||
|
@ -494,6 +494,7 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
||||
for(uint32_t i=0;i<kit->value.size();++i)
|
||||
if(kit->value[i] == ';')
|
||||
{
|
||||
if(!b.empty()) // security!
|
||||
ignored_suffixes.push_back(b) ;
|
||||
b.clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user