From 21fe2413cdf3311d1df6222af1b6f9004e0b62a5 Mon Sep 17 00:00:00 2001 From: csoler Date: Sat, 29 Nov 2014 17:26:06 +0000 Subject: [PATCH] two improvements of turtle router logic: increase of TR cache storage time to avoid too many void tunnels due to bouncing TR beyond storage period of 120 secs; prevent openning upload tunnels for files currently being downloaded before any chunk was obtained. Suggested by Jo. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7719 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- libretroshare/src/ft/ftserver.cc | 18 ++++++++++++++++-- libretroshare/src/turtle/p3turtle.cc | 14 +++++++------- 2 files changed, 23 insertions(+), 9 deletions(-) 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