From 830404a25ef7839de42622b2a9319a871d52a4da Mon Sep 17 00:00:00 2001 From: csoler Date: Wed, 27 Nov 2013 20:12:16 +0000 Subject: [PATCH] fixed the bug that caused unwanted direct downloads. A check was missing in ftController::FileRequest git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6911 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftcontroller.cc | 31 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index 35e155366..71e46d777 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -1179,27 +1179,28 @@ bool ftController::FileRequest(const std::string& fname, const std::string& has */ for(it = srcIds.begin(); it != srcIds.end(); it++) - { - uint32_t i, j; - if ((dit->second)->mTransfer->getPeerState(*it, i, j)) + if(rsPeers->servicePermissionFlags_sslid(*it) & RS_SERVICE_PERM_DIRECT_DL) { + uint32_t i, j; + if ((dit->second)->mTransfer->getPeerState(*it, i, j)) + { #ifdef CONTROL_DEBUG - std::cerr << "ftController::FileRequest() Peer Existing"; + std::cerr << "ftController::FileRequest() Peer Existing"; + std::cerr << std::endl; +#endif + continue; /* already added peer */ + } + +#ifdef CONTROL_DEBUG + std::cerr << "ftController::FileRequest() Adding Peer: " << *it; std::cerr << std::endl; #endif - continue; /* already added peer */ + (dit->second)->mTransfer->addFileSource(*it); + setPeerState(dit->second->mTransfer, *it, rate, mLinkMgr->isOnline(*it)); + + IndicateConfigChanged(); /* new peer for transfer -> save */ } -#ifdef CONTROL_DEBUG - std::cerr << "ftController::FileRequest() Adding Peer: " << *it; - std::cerr << std::endl; -#endif - (dit->second)->mTransfer->addFileSource(*it); - setPeerState(dit->second->mTransfer, *it, rate, mLinkMgr->isOnline(*it)); - - IndicateConfigChanged(); /* new peer for transfer -> save */ - } - if (srcIds.size() == 0) { #ifdef CONTROL_DEBUG