mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-28 16:17:28 -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
3 changed files with 9 additions and 6 deletions
|
@ -191,9 +191,9 @@ void HashStorage::data_tick()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RS_STACK_MUTEX(mHashMtx) ;
|
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.size = size ;
|
||||||
info.modf_stamp = job.ts ;
|
info.modf_stamp = job.ts ;
|
||||||
info.time_stamp = time(NULL);
|
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.
|
// check if the hash is up to date w.r.t. cache.
|
||||||
|
|
||||||
#ifdef HASHSTORAGE_DEBUG
|
#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
|
#endif
|
||||||
RS_STACK_MUTEX(mHashMtx) ;
|
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.size = size ;
|
||||||
job.client_param = client_param ;
|
job.client_param = client_param ;
|
||||||
job.full_path = full_path ;
|
job.full_path = full_path ;
|
||||||
|
job.real_path = real_path ;
|
||||||
job.ts = mod_time ;
|
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
|
// 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)
|
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
|
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 ;
|
uint64_t size ;
|
||||||
HashStorageClient *client;
|
HashStorageClient *client;
|
||||||
uint32_t client_param ;
|
uint32_t client_param ;
|
||||||
|
|
|
@ -494,7 +494,8 @@ bool p3FileDatabase::loadList(std::list<RsItem *>& load)
|
||||||
for(uint32_t i=0;i<kit->value.size();++i)
|
for(uint32_t i=0;i<kit->value.size();++i)
|
||||||
if(kit->value[i] == ';')
|
if(kit->value[i] == ';')
|
||||||
{
|
{
|
||||||
ignored_suffixes.push_back(b) ;
|
if(!b.empty()) // security!
|
||||||
|
ignored_suffixes.push_back(b) ;
|
||||||
b.clear();
|
b.clear();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue