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:
drbob 2008-06-10 00:47:24 +00:00
parent 20aa2a031b
commit e42ce13454
6 changed files with 56 additions and 13 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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)