added methods to get files from hash(hash) in directory_storage and ftServer

This commit is contained in:
mr-alice 2016-10-25 00:08:27 +02:00
parent 2d72b88130
commit 0387a28e78
9 changed files with 122 additions and 44 deletions

View file

@ -979,16 +979,20 @@ bool p3FileDatabase::search(const RsFileHash &hash, FileSearchFlags hintflags, F
if(hintflags & RS_FILE_HINTS_LOCAL)
{
std::list<EntryIndex> res;
mLocalSharedDirs->searchHash(hash,res) ;
RsFileHash real_hash ;
EntryIndex indx;
if(res.empty())
if(!mLocalSharedDirs->searchHash(hash,real_hash,indx))
return false;
EntryIndex indx = *res.begin() ; // no need to report duplicates
mLocalSharedDirs->getFileInfo(indx,info) ;
if(!real_hash.isNull())
{
info.hash = real_hash ;
info.transfer_info_flags |= RS_FILE_REQ_ENCRYPTED ;
}
return true;
}