* Moved DataRate interface from rsiface (old) -> rsConfig.

* Internally moved storage of data rate from pqipersongroup -> p3serverconfig
 * made DataRate + Operating Mode work together.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5889 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-11-25 20:25:34 +00:00
parent 0fa8d55062
commit de80f2aa3e
10 changed files with 113 additions and 130 deletions

View file

@ -108,7 +108,7 @@ int pqipersongrp::tickServiceSend()
// init
pqipersongrp::pqipersongrp(SecurityPolicy *glob, unsigned long flags)
:pqihandler(glob), pqil(NULL), config(NULL), initFlags(flags)
:pqihandler(glob), pqil(NULL), initFlags(flags)
{
}
@ -222,57 +222,6 @@ bool pqipersongrp::resetListener(struct sockaddr_in &local)
return 1;
}
/* NOT bothering to protect Config with a mutex.... it is not going to change
* and has its own internal mutexs.
*/
int pqipersongrp::setConfig(p3GeneralConfig *cfg)
{
config = cfg;
return 1;
}
static const std::string pqih_ftr("PQIH_FTR");
int pqipersongrp::save_config()
{
char line[512];
sprintf(line, "%f %f", getMaxRate(true), getMaxRate(false));
if (config)
{
config -> setSetting(pqih_ftr, std::string(line));
}
return 1;
}
int pqipersongrp::load_config()
{
std::string line;
if (config)
{
line = config -> getSetting(pqih_ftr);
}
float mri, mro;
if (2 == sscanf(line.c_str(), "%f %f", &mri, &mro))
{
setMaxRate(true, mri);
setMaxRate(false, mro);
}
else
{
pqioutput(PQL_DEBUG_BASIC, pqipersongrpzone,
"pqipersongrp::load_config() Loading Default Rates!");
setMaxRate(true, DEFAULT_DOWNLOAD_KB_RATE);
setMaxRate(false, DEFAULT_UPLOAD_KB_RATE);
}
return 1;
}
void pqipersongrp::statusChange(const std::list<pqipeer> &plist)
{

View file

@ -57,10 +57,6 @@ class pqipersongrp: public pqihandler, public pqiMonitor, public p3ServiceServer
virtual bool resetListener(struct sockaddr_in &local); // overloaded from pqiNetListener
int init_listener();
int setConfig(p3GeneralConfig *cfg);
int save_config();
int load_config();
/*************** pqiMonitor callback ***********************/
virtual void statusChange(const std::list<pqipeer> &plist);
@ -119,7 +115,6 @@ virtual int checkOutgoingRsItem(RsItem *item, int global)
int tickServiceSend();
pqilistener *pqil;
p3GeneralConfig *config;
unsigned long initFlags;
};