diff --git a/libretroshare/src/pqi/p3dhtmgr.cc b/libretroshare/src/pqi/p3dhtmgr.cc index 8ff879b83..78b34db95 100644 --- a/libretroshare/src/pqi/p3dhtmgr.cc +++ b/libretroshare/src/pqi/p3dhtmgr.cc @@ -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); diff --git a/libretroshare/src/pqi/pqihandler.cc b/libretroshare/src/pqi/pqihandler.cc index 684a773df..deb8bd1d6 100644 --- a/libretroshare/src/pqi/pqihandler.cc +++ b/libretroshare/src/pqi/pqihandler.cc @@ -573,18 +573,20 @@ 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 << "\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 << "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; +} + diff --git a/libretroshare/src/pqi/pqihandler.h b/libretroshare/src/pqi/pqihandler.h index f8ef9dae9..1dc67ec1a 100644 --- a/libretroshare/src/pqi/pqihandler.h +++ b/libretroshare/src/pqi/pqihandler.h @@ -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) diff --git a/libretroshare/src/rsiface/rsiface.h b/libretroshare/src/rsiface/rsiface.h index c15138a74..333cedeeb 100644 --- a/libretroshare/src/rsiface/rsiface.h +++ b/libretroshare/src/rsiface/rsiface.h @@ -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; diff --git a/libretroshare/src/rsserver/p3face-config.cc b/libretroshare/src/rsserver/p3face-config.cc index 764299a05..5048e99bc 100644 --- a/libretroshare/src/rsserver/p3face-config.cc +++ b/libretroshare/src/rsserver/p3face-config.cc @@ -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); diff --git a/libretroshare/src/rsserver/p3face.h b/libretroshare/src/rsserver/p3face.h index c75a59fbc..eb8705ad7 100644 --- a/libretroshare/src/rsserver/p3face.h +++ b/libretroshare/src/rsserver/p3face.h @@ -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 );