From 43f7b6c0ba930f5a1b03d94ad999af4a1481746f Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Fri, 29 May 2020 11:03:57 +0200 Subject: [PATCH] RsFiles::alreadyHaveFile look into extra list too --- libretroshare/src/file_sharing/p3filelists.cc | 10 ++++++++-- libretroshare/src/ft/ftserver.cc | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/libretroshare/src/file_sharing/p3filelists.cc b/libretroshare/src/file_sharing/p3filelists.cc index c7db78b0f..55a28dec6 100644 --- a/libretroshare/src/file_sharing/p3filelists.cc +++ b/libretroshare/src/file_sharing/p3filelists.cc @@ -1424,9 +1424,15 @@ int p3FileDatabase::SearchBoolExp(RsRegularExpression::Expression *exp, std::lis return !results.empty() ; } -bool p3FileDatabase::search(const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const + +bool p3FileDatabase::search( + const RsFileHash &hash, FileSearchFlags hintflags, FileInfo &info) const { - RS_STACK_MUTEX(mFLSMtx) ; + RS_STACK_MUTEX(mFLSMtx); + + if( (hintflags & RS_FILE_HINTS_EXTRA) && + mExtraFiles->search(hash, hintflags, info) ) + return true; if(hintflags & RS_FILE_HINTS_LOCAL) { diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index 3ae1af491..08e294d2b 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -293,7 +293,8 @@ bool ftServer::getFileData(const RsFileHash& hash, uint64_t offset, uint32_t& re bool ftServer::alreadyHaveFile(const RsFileHash& hash, FileInfo &info) { - return mFileDatabase->search(hash, RS_FILE_HINTS_LOCAL, info); + return mFileDatabase->search( + hash, RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_LOCAL, info ); } bool ftServer::FileRequest(