added non aggressive mode option to turtle router to make distant chat happy

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7856 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2015-01-22 20:25:39 +00:00
parent d886c34233
commit 817aa793fc
5 changed files with 12 additions and 10 deletions

View file

@ -374,7 +374,8 @@ void p3turtle::manageTunnels()
std::cerr << "Total speed = " << total_speed << ", tunel factor = " << tunnel_keeping_factor << " new time = " << time_t(REGULAR_TUNNEL_DIGGING_TIME*tunnel_keeping_factor) << std::endl;
#endif
if( (it->second.tunnels.empty() && now >= it->second.last_digg_time+EMPTY_TUNNELS_DIGGING_TIME) || now >= it->second.last_digg_time + time_t(REGULAR_TUNNEL_DIGGING_TIME*tunnel_keeping_factor))
if( (it->second.tunnels.empty() && now >= it->second.last_digg_time+EMPTY_TUNNELS_DIGGING_TIME)
|| (it->second.use_aggressive_mode && now >= it->second.last_digg_time + time_t(REGULAR_TUNNEL_DIGGING_TIME*tunnel_keeping_factor)))
{
#ifdef P3TURTLE_DEBUG
std::cerr << "pushed hash " << it->first << ", for digging. Old = " << now - it->second.last_digg_time << std::endl;
@ -1818,7 +1819,7 @@ TurtleRequestId p3turtle::turtleSearch(const LinearizedExpression& expr)
return id ;
}
void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *client_service)
void p3turtle::monitorTunnels(const RsFileHash& hash,RsTurtleClientService *client_service,bool allow_multi_tunnels)
{
{
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/

View file

@ -197,9 +197,10 @@ class TurtleHashInfo
{
public:
std::vector<TurtleTunnelId> tunnels ; // list of active tunnel ids for this file hash
TurtleRequestId last_request ; // last request for the tunnels of this hash
time_t last_digg_time ; // last time the tunnel digging happenned.
RsTurtleClientService *service ; // client service to which items should be sent. Never NULL.
TurtleRequestId last_request ; // last request for the tunnels of this hash
time_t last_digg_time ; // last time the tunnel digging happenned.
RsTurtleClientService *service ; // client service to which items should be sent. Never NULL.
bool use_aggressive_mode ; // allow to re-digg tunnels even when some are already available
};
// Subclassing:
@ -251,7 +252,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
// This function should be called in addition to ftServer::FileRequest() so that the turtle router
// automatically provide tunnels for the file to download.
//
virtual void monitorTunnels(const RsFileHash& file_hash,RsTurtleClientService *client_service) ;
virtual void monitorTunnels(const RsFileHash& file_hash,RsTurtleClientService *client_service, bool allow_multi_tunnels) ;
/// This should be called when canceling a file download, so that the turtle router stops
/// handling tunnels for this file.