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
This commit is contained in:
csoler 2014-11-29 17:26:06 +00:00
parent 3d6b5371f7
commit 21fe2413cd
2 changed files with 23 additions and 9 deletions

View File

@ -487,8 +487,22 @@ void ftServer::removeVirtualPeer(const TurtleFileHash& hash,const TurtleVirtualP
bool ftServer::handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id) bool ftServer::handleTunnelRequest(const RsFileHash& hash,const RsPeerId& peer_id)
{ {
FileInfo 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 | RS_FILE_HINTS_DOWNLOAD, 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<info2.chunks.size();++i)
if(info2.chunks[i] == FileChunksInfo::CHUNK_DONE)
{
res = true ;
break ;
}
}
#ifdef SERVER_DEBUG #ifdef SERVER_DEBUG
std::cerr << "ftServer: performing local hash search for hash " << hash << std::endl; std::cerr << "ftServer: performing local hash search for hash " << hash << std::endl;

View File

@ -79,7 +79,7 @@ void TS_dumpState() ;
// - The total number of TR per second emmited from self will be MAX_TUNNEL_REQS_PER_SECOND / TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS = 0.5 // - The total number of TR per second emmited from self will be MAX_TUNNEL_REQS_PER_SECOND / TIME_BETWEEN_TUNNEL_MANAGEMENT_CALLS = 0.5
// - I updated forward probabilities to higher values, and min them to 1/nb_connected_friends to prevent blocking tunnels. // - I updated forward probabilities to higher values, and min them to 1/nb_connected_friends to prevent blocking tunnels.
// //
static const time_t TUNNEL_REQUESTS_LIFE_TIME = 120 ; /// life time for tunnel requests in the cache. static const time_t TUNNEL_REQUESTS_LIFE_TIME = 240 ; /// life time for tunnel requests in the cache.
static const time_t SEARCH_REQUESTS_LIFE_TIME = 240 ; /// life time for search requests in the cache static const time_t SEARCH_REQUESTS_LIFE_TIME = 240 ; /// life time for search requests in the cache
static const time_t REGULAR_TUNNEL_DIGGING_TIME = 300 ; /// maximum interval between two tunnel digging campaigns. static const time_t REGULAR_TUNNEL_DIGGING_TIME = 300 ; /// maximum interval between two tunnel digging campaigns.
static const time_t MAXIMUM_TUNNEL_IDLE_TIME = 60 ; /// maximum life time of an unused tunnel. static const time_t MAXIMUM_TUNNEL_IDLE_TIME = 60 ; /// maximum life time of an unused tunnel.