mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 07:29:33 -05:00
Add in storage of the current Data Rate to pqihandler.cc.
Add in interface for the Data Rates. Increase DHT Bootstrap buckets to 8. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@590 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
20aa2a031b
commit
e42ce13454
@ -63,7 +63,7 @@
|
||||
|
||||
#define DHT_DEFAULT_WAITTIME 1 /* Std sleep break period */
|
||||
|
||||
#define DHT_NUM_BOOTSTRAP_BINS 4
|
||||
#define DHT_NUM_BOOTSTRAP_BINS 8
|
||||
#define DHT_MIN_BOOTSTRAP_REQ_PERIOD 30
|
||||
|
||||
void printDhtPeerEntry(dhtPeerEntry *ent, std::ostream &out);
|
||||
|
@ -574,17 +574,19 @@ int pqihandler::UpdateRates()
|
||||
extra_bw_out += crate_out - avg_rate_out;
|
||||
}
|
||||
//std::cerr << "\tSM(" << mod -> smi << ")";
|
||||
// std::cerr << "In A: " << mod -> pqi -> getMaxRate(true);
|
||||
// std::cerr << " C: " << crate_in;
|
||||
// std::cerr << " && Out A: " << mod -> pqi -> getMaxRate(false);
|
||||
// std::cerr << " C: " << crate_out << std::endl;
|
||||
std::cerr << "In A: " << mod -> pqi -> getMaxRate(true);
|
||||
std::cerr << " C: " << crate_in;
|
||||
std::cerr << " && Out A: " << mod -> pqi -> getMaxRate(false);
|
||||
std::cerr << " C: " << crate_out << std::endl;
|
||||
}
|
||||
// std::cerr << "Totals (In) Used B/W " << used_bw_in;
|
||||
// std::cerr << " Excess B/W " << extra_bw_in;
|
||||
// std::cerr << " Available B/W " << avail_in << std::endl;
|
||||
// std::cerr << "Totals (Out) Used B/W " << used_bw_out;
|
||||
// std::cerr << " Excess B/W " << extra_bw_out;
|
||||
// std::cerr << " Available B/W " << avail_out << std::endl;
|
||||
std::cerr << "Totals (In) Used B/W " << used_bw_in;
|
||||
std::cerr << " Excess B/W " << extra_bw_in;
|
||||
std::cerr << " Available B/W " << avail_in << std::endl;
|
||||
std::cerr << "Totals (Out) Used B/W " << used_bw_out;
|
||||
std::cerr << " Excess B/W " << extra_bw_out;
|
||||
std::cerr << " Available B/W " << avail_out << std::endl;
|
||||
|
||||
StoreCurrentRates(used_bw_in, used_bw_out);
|
||||
|
||||
if (used_bw_in > avail_in)
|
||||
{
|
||||
@ -706,7 +708,20 @@ int pqihandler::UpdateRates()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void pqihandler::getCurrentRates(float &in, float &out)
|
||||
{
|
||||
in = rateTotal_in;
|
||||
out = rateTotal_out;
|
||||
}
|
||||
|
||||
void pqihandler::StoreCurrentRates(float in, float out)
|
||||
{
|
||||
rateTotal_in = in;
|
||||
rateTotal_out = out;
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,6 +78,9 @@ float getMaxIndivRate(bool in);
|
||||
void setMaxRate(bool in, float val);
|
||||
float getMaxRate(bool in);
|
||||
|
||||
void getCurrentRates(float &in, float &out);
|
||||
|
||||
|
||||
protected:
|
||||
/* check to be overloaded by those that can
|
||||
* generates warnings otherwise
|
||||
@ -100,12 +103,15 @@ void SortnStoreItem(RsItem *item);
|
||||
|
||||
// rate control.
|
||||
int UpdateRates();
|
||||
void StoreCurrentRates(float in, float out);
|
||||
|
||||
float rateIndiv_in;
|
||||
float rateIndiv_out;
|
||||
float rateMax_in;
|
||||
float rateMax_out;
|
||||
|
||||
float rateTotal_in;
|
||||
float rateTotal_out;
|
||||
};
|
||||
|
||||
inline void pqihandler::setMaxIndivRate(bool in, float val)
|
||||
|
@ -259,6 +259,7 @@ virtual int ConfigRemoveSharedDir( std::string dir ) = 0;
|
||||
virtual int ConfigSetIncomingDir( std::string dir ) = 0;
|
||||
|
||||
virtual int ConfigSetDataRates( int total, int indiv ) = 0;
|
||||
virtual int ConfigGetDataRates( float &inKb, float &outKb) = 0;
|
||||
virtual int ConfigSetBootPrompt( bool on ) = 0;
|
||||
virtual void ConfigFinalSave( ) = 0;
|
||||
virtual void rsGlobalShutDown( ) = 0;
|
||||
|
@ -265,6 +265,25 @@ int RsServer::ConfigSetDataRates( int total, int indiv ) /* in kbrates */
|
||||
}
|
||||
|
||||
|
||||
int RsServer::ConfigGetDataRates( float &inKb, float &outKb ) /* in kbrates */
|
||||
{
|
||||
/* fill the rsiface class */
|
||||
RsIface &iface = getIface();
|
||||
|
||||
/* lock Mutexes */
|
||||
lockRsCore(); /* LOCK */
|
||||
iface.lockData(); /* LOCK */
|
||||
|
||||
pqih -> getCurrentRates(inKb, outKb);
|
||||
|
||||
/* unlock Mutexes */
|
||||
iface.unlockData(); /* UNLOCK */
|
||||
unlockRsCore(); /* UNLOCK */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int RsServer::ConfigSetBootPrompt( bool on )
|
||||
{
|
||||
|
||||
@ -315,7 +334,7 @@ int RsServer::UpdateAllConfig()
|
||||
config.uPnPState = mConnMgr->getUPnPState();
|
||||
config.uPnPActive = mConnMgr->getUPnPEnabled();
|
||||
config.DHTPeers = 20;
|
||||
config.DHTActive = mConnMgr->getDHTEnabled();;
|
||||
config.DHTActive = mConnMgr->getDHTEnabled();
|
||||
|
||||
/* Notify of Changes */
|
||||
iface.setChanged(RsIface::Config);
|
||||
|
@ -249,6 +249,8 @@ virtual int ConfigSetIncomingDir( std::string dir );
|
||||
//virtual int ConfigSetExtName( std::string addr );
|
||||
//virtual int ConfigSetLanConfig( bool fire, bool forw );
|
||||
|
||||
|
||||
virtual int ConfigGetDataRates(float &inKb, float &outKb);
|
||||
virtual int ConfigSetDataRates( int total, int indiv );
|
||||
virtual int ConfigSetBootPrompt( bool on );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user