From 1491a051dc1e3b17417bb6cc3729bf25f24cef41 Mon Sep 17 00:00:00 2001 From: cyril soler Date: Mon, 17 Jul 2017 11:16:48 +0200 Subject: [PATCH] fixed deadlock situation in FT causing multiple bugs: lock when DLing from a file list a file that is already being downloaded, and lock when a FT module find a direct source among friends --- libretroshare/src/ft/ftcontroller.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libretroshare/src/ft/ftcontroller.cc b/libretroshare/src/ft/ftcontroller.cc index a349f8d1b..37ec8ac0f 100644 --- a/libretroshare/src/ft/ftcontroller.cc +++ b/libretroshare/src/ft/ftcontroller.cc @@ -292,7 +292,7 @@ void ftController::searchForDirectSources() for( std::list::const_iterator pit = info.peers.begin(); pit != info.peers.end(); ++pit ) { bool bAllowDirectDL = false; - switch (rsFiles->filePermDirectDL()) { + switch (mFilePermDirectDLPolicy) { case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break; @@ -961,7 +961,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash for(std::list::iterator it = srcIds.begin(); it != srcIds.end(); ) { bool bAllowDirectDL = false; - switch (rsFiles->filePermDirectDL()) { + switch (mFilePermDirectDLPolicy) { case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break; @@ -1026,7 +1026,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash for(it = srcIds.begin(); it != srcIds.end(); ++it) { bool bAllowDirectDL = false; - switch (rsFiles->filePermDirectDL()) { + switch (mFilePermDirectDLPolicy) { case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; default:bAllowDirectDL = (rsPeers->servicePermissionFlags(*it) & RS_NODE_PERM_DIRECT_DL); break; @@ -1088,7 +1088,7 @@ bool ftController::FileRequest(const std::string& fname, const RsFileHash& hash // Because this is auto-add, we only add sources that we allow to DL from using direct transfers. bool bAllowDirectDL = false; - switch (rsFiles->filePermDirectDL()) { + switch (mFilePermDirectDLPolicy) { case RS_FILE_PERM_DIRECT_DL_YES: bAllowDirectDL = true; break; case RS_FILE_PERM_DIRECT_DL_NO: bAllowDirectDL = false; break; default:bAllowDirectDL = (rsPeers->servicePermissionFlags(pit->peerId) & RS_NODE_PERM_DIRECT_DL); break;