* Added second (temporary) switch to turtle.

* Use session switch for OperatingMode.
 * made OperatingMode temporary - not saved.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5895 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-11-25 22:49:00 +00:00
parent 80dfa620b2
commit 90415627a2
6 changed files with 70 additions and 4 deletions

View file

@ -105,6 +105,8 @@ p3turtle::p3turtle(p3LinkMgr *lm,ftServer *fs)
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
_turtle_routing_enabled = true ;
_turtle_routing_session_enabled = true;
_ft_server = fs ;
_ft_controller = fs->getController() ;
@ -140,6 +142,25 @@ bool p3turtle::enabled() const
return _turtle_routing_enabled ;
}
void p3turtle::setSessionEnabled(bool b)
{
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
_turtle_routing_session_enabled = b;
if(b)
std::cerr << "Enabling turtle routing for this Session" << std::endl;
else
std::cerr << "Disabling turtle routing for this Session" << std::endl;
}
bool p3turtle::sessionEnabled() const
{
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
return _turtle_routing_session_enabled ;
}
int p3turtle::tick()
{
// Handle tunnel trafic
@ -173,7 +194,7 @@ int p3turtle::tick()
#ifdef P3TURTLE_DEBUG
std::cerr << "Calling tunnel management." << std::endl ;
#endif
if(_turtle_routing_enabled)
if(_turtle_routing_enabled && _turtle_routing_session_enabled)
manageTunnels() ;
{
@ -728,7 +749,7 @@ int p3turtle::handleIncoming()
{
nhandled++;
if(!_turtle_routing_enabled)
if(!(_turtle_routing_enabled && _turtle_routing_session_enabled))
delete item ;
else
{

View file

@ -223,6 +223,11 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
virtual void setEnabled(bool) ;
virtual bool enabled() const ;
// This is temporary, used by Operating Mode.
// Turtle operates when both enabled() && sessionEnabled() are true.
virtual void setSessionEnabled(bool);
virtual bool sessionEnabled() const;
// Lauches a search request through the pipes, and immediately returns
// the request id, which will be further used by the gui to store results
// as they come back.
@ -431,6 +436,7 @@ class p3turtle: public p3Service, public RsTurtle, public p3Config
float _max_tr_up_rate ;
bool _turtle_routing_enabled ;
bool _turtle_routing_session_enabled ;
#ifdef P3TURTLE_DEBUG
// debug function