mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 00:07:09 -05:00
converted static variable to class member in pqihandler
This commit is contained in:
parent
34f49d4ae8
commit
972de42864
@ -70,18 +70,19 @@ static const float PQI_HANDLER_NB_PRIORITY_RATIO = 2 ;
|
|||||||
|
|
||||||
pqihandler::pqihandler() : coreMtx("pqihandler")
|
pqihandler::pqihandler() : coreMtx("pqihandler")
|
||||||
{
|
{
|
||||||
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
RsStackMutex stack(coreMtx); /**************** LOCKED MUTEX ****************/
|
||||||
|
|
||||||
// setup minimal total+individual rates.
|
// setup minimal total+individual rates.
|
||||||
rateIndiv_out = 0.01;
|
rateIndiv_out = 0.01;
|
||||||
rateIndiv_in = 0.01;
|
rateIndiv_in = 0.01;
|
||||||
rateMax_out = 0.01;
|
rateMax_out = 0.01;
|
||||||
rateMax_in = 0.01;
|
rateMax_in = 0.01;
|
||||||
rateTotal_in = 0.0 ;
|
rateTotal_in = 0.0 ;
|
||||||
rateTotal_out = 0.0 ;
|
rateTotal_out = 0.0 ;
|
||||||
last_m = time(NULL) ;
|
last_m = time(NULL) ;
|
||||||
nb_ticks = 0 ;
|
nb_ticks = 0 ;
|
||||||
ticks_per_sec = 5 ; // initial guess
|
mLastRateCapUpdate = 0 ;
|
||||||
|
ticks_per_sec = 5 ; // initial guess
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,9 +117,9 @@ int pqihandler::tick()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static time_t last_print_time = 0 ;
|
|
||||||
time_t now = time(NULL) ;
|
time_t now = time(NULL) ;
|
||||||
if(now > last_print_time + 5)
|
|
||||||
|
if(now > mLastRateCapUpdate + 5)
|
||||||
{
|
{
|
||||||
// every 5 secs, update the max rates for all modules
|
// every 5 secs, update the max rates for all modules
|
||||||
|
|
||||||
@ -133,7 +134,7 @@ int pqihandler::tick()
|
|||||||
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
|
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
|
||||||
}
|
}
|
||||||
|
|
||||||
last_print_time = now ;
|
mLastRateCapUpdate = now ;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateRates();
|
UpdateRates();
|
||||||
|
@ -121,6 +121,7 @@ protected:
|
|||||||
|
|
||||||
uint32_t nb_ticks ;
|
uint32_t nb_ticks ;
|
||||||
time_t last_m ;
|
time_t last_m ;
|
||||||
|
time_t mLastRateCapUpdate ;
|
||||||
float ticks_per_sec ;
|
float ticks_per_sec ;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user