diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index d30817dcd..052503825 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -167,9 +167,9 @@ void ftController::addFileSource(const std::string& hash,const std::string& peer std::map::iterator it = mDownloads.find(hash); -#ifdef CONTROL_DEBUG +//#ifdef CONTROL_DEBUG std::cerr << "ftController: Adding source " << peer_id << " to current download hash=" << hash ; -#endif +//#endif if(it != mDownloads.end()) { it->second->mTransfer->addFileSource(peer_id); @@ -1133,6 +1133,20 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has } } + // remove the sources from the list, if they don't have clearance for direct transfer. This happens only for non cache files. + // + if(!(flags & RS_FILE_REQ_CACHE)) + for(std::list::iterator it = srcIds.begin(); it != srcIds.end(); ) + if(!(rsPeers->servicePermissionFlags_sslid(*it) & RS_SERVICE_PERM_DIRECT_DL)) + { + std::list::iterator tmp(it) ; + ++tmp ; + srcIds.erase(it) ; + it = tmp ; + } + else + ++it ; + std::list::const_iterator it; std::list::const_iterator pit; @@ -1213,6 +1227,7 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has } } /******* UNLOCKED ********/ + if(!(flags & RS_FILE_REQ_NO_SEARCH)) { /* do a source search - for any extra sources */