diff --git a/libretroshare/src/ft/ftserver.cc b/libretroshare/src/ft/ftserver.cc index a0d67fea8..99ca19595 100644 --- a/libretroshare/src/ft/ftserver.cc +++ b/libretroshare/src/ft/ftserver.cc @@ -486,9 +486,23 @@ void ftServer::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualP bool ftServer::handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) { - FileInfo info ; - bool res = FileDetails(hash, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY | RS_FILE_HINTS_DOWNLOAD, info); + FileInfo info ; + bool res = FileDetails(hash, RS_FILE_HINTS_NETWORK_WIDE | RS_FILE_HINTS_LOCAL | RS_FILE_HINTS_EXTRA | RS_FILE_HINTS_SPEC_ONLY, info); + if( (!res) && FileDetails(hash,RS_FILE_HINTS_DOWNLOAD,info)) + { + // This file is currently being downloaded. Let's look if we already have a chunk or not. If not, no need to + // share the file! + + FileChunksInfo info2 ; + if(rsFiles->FileDownloadChunksDetails(hash, info2)) + for(uint32_t i=0;i