Removed configuration type (uint32) as its not needed or really used.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7212 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2014-03-29 05:20:57 +00:00
parent 190988c3cc
commit 0e6302ac6a
21 changed files with 66 additions and 118 deletions

View file

@ -121,12 +121,12 @@ void AuthGPG::exit()
}
AuthGPG::AuthGPG(const std::string& path_to_public_keyring,const std::string& path_to_secret_keyring,const std::string& path_to_trustdb,const std::string& pgp_lock_file)
:p3Config(CONFIG_TYPE_AUTHGPG),
PGPHandler(path_to_public_keyring,path_to_secret_keyring,path_to_trustdb,pgp_lock_file),
gpgMtxService("AuthGPG-service"),
gpgMtxEngine("AuthGPG-engine"),
gpgMtxData("AuthGPG-data"),
gpgKeySelected(false)
:p3Config(),
PGPHandler(path_to_public_keyring,path_to_secret_keyring,path_to_trustdb,pgp_lock_file),
gpgMtxService("AuthGPG-service"),
gpgMtxEngine("AuthGPG-engine"),
gpgMtxData("AuthGPG-data"),
gpgKeySelected(false)
{
_force_sync_database = false ;
start();

View file

@ -276,7 +276,7 @@ sslcert::sslcert(X509 *x509, const RsPeerId& pid)
AuthSSLimpl::AuthSSLimpl()
: p3Config(CONFIG_TYPE_AUTHSSL), sslctx(NULL),
: p3Config(), sslctx(NULL),
mOwnCert(NULL), sslMtx("AuthSSL"), mOwnPrivateKey(NULL), mOwnPublicKey(NULL), init(0)
{
}

View file

@ -57,10 +57,10 @@ void p3ConfigMgr::tick()
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
/* iterate through and check if any have changed */
std::map<uint32_t, pqiConfig *>::iterator it;
for(it = configs.begin(); it != configs.end(); it++)
std::list<pqiConfig *>::iterator it;
for(it = mConfigs.begin(); it != mConfigs.end(); it++)
{
if (it->second->HasConfigChanged(0))
if ((*it)->HasConfigChanged(0))
{
#ifdef CONFIG_DEBUG
@ -104,17 +104,17 @@ void p3ConfigMgr::saveConfig()
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
std::map<uint32_t, pqiConfig *>::iterator it;
for(it = configs.begin(); it != configs.end(); it++)
std::list<pqiConfig *>::iterator it;
for(it = mConfigs.begin(); it != mConfigs.end(); it++)
{
if (it->second->HasConfigChanged(1))
if ((*it)->HasConfigChanged(1))
{
#ifdef CONFIG_DEBUG
std::cerr << "p3ConfigMgr::globalSaveConfig() Saving Element: ";
std::cerr << it->first;
std::cerr << std::endl;
#endif
ok &= it->second->saveConfiguration();
ok &= (*it)->saveConfiguration();
}
/* save metaconfig */
}
@ -131,9 +131,9 @@ void p3ConfigMgr::loadConfiguration()
void p3ConfigMgr::loadConfig()
{
std::map<uint32_t, pqiConfig *>::iterator cit;
RsFileHash dummyHash ;
for (cit = configs.begin(); cit != configs.end(); cit++)
std::list<pqiConfig *>::iterator cit;
RsFileHash dummyHash ;
for (cit = mConfigs.begin(); cit != mConfigs.end(); cit++)
{
#ifdef CONFIG_DEBUG
std::cerr << "p3ConfigMgr::loadConfig() Element: ";
@ -141,11 +141,11 @@ void p3ConfigMgr::loadConfig()
std::cerr << std::endl;
#endif
cit->second->loadConfiguration(dummyHash);
(*cit)->loadConfiguration(dummyHash);
/* force config to NOT CHANGED */
cit->second->HasConfigChanged(0);
cit->second->HasConfigChanged(1);
(*cit)->HasConfigChanged(0);
(*cit)->HasConfigChanged(1);
}
return;
@ -165,16 +165,20 @@ void p3ConfigMgr::addConfiguration(std::string file, pqiConfig *conf)
filename += "config/";
filename += file;
conf->setFilename(filename);
std::map<uint32_t, pqiConfig *>::iterator cit = configs.find(conf->Type());
if (cit != configs.end())
std::list<pqiConfig *>::iterator cit = std::find(mConfigs.begin(),mConfigs.end(),conf);
if (cit != mConfigs.end())
{
std::cerr << "p3Config::addConfiguration() WARNING: type " << conf->Type();
std::cerr << " with filename " << filename;
std::cerr << " already added with filename " << cit->second->Filename() << std::endl;
std::cerr << "p3Config::addConfiguration() Config already added";
std::cerr << std::endl;
std::cerr << "\tOriginal filename " << (*cit)->Filename();
std::cerr << std::endl;
std::cerr << "\tIgnoring new filename " << filename;
std::cerr << std::endl;
return;
}
configs[conf->Type()] = conf;
conf->setFilename(filename);
mConfigs.push_back(conf);
}
@ -188,8 +192,8 @@ void p3ConfigMgr::completeConfiguration()
p3Config::p3Config(uint32_t t)
:pqiConfig(t)
p3Config::p3Config()
:pqiConfig()
{
return;
}
@ -407,7 +411,7 @@ bool p3Config::saveConfig()
/**************************** CONFIGURATION CLASSES ********************/
p3GeneralConfig::p3GeneralConfig()
:p3Config(CONFIG_TYPE_GENERAL)
:p3Config()
{
return;
}
@ -544,8 +548,8 @@ bool p3GeneralConfig::loadList(std::list<RsItem *>& load)
* only the Indication and hash really need it
*/
pqiConfig::pqiConfig(uint32_t t)
: cfgMtx("pqiConfig"), ConfInd(2), type(t)
pqiConfig::pqiConfig()
: cfgMtx("pqiConfig"), ConfInd(2)
{
return;
}
@ -555,12 +559,6 @@ pqiConfig::~pqiConfig()
return;
}
uint32_t pqiConfig::Type()
{
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
return type;
}
const std::string& pqiConfig::Filename()
{
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/

View file

@ -30,6 +30,7 @@
#include <string>
#include <map>
#include <set>
#include "pqi/pqi_base.h"
#include "pqi/pqiindic.h"
@ -59,48 +60,9 @@
*
*********************/
const uint32_t CONFIG_TYPE_GENERAL = 0x0001;
const uint32_t CONFIG_TYPE_PEERS = 0x0002;
const uint32_t CONFIG_TYPE_FSERVER = 0x0003;
const uint32_t CONFIG_TYPE_MSGS = 0x0004;
const uint32_t CONFIG_TYPE_AUTHGPG = 0x0006;
/* new FileTransfer */
const uint32_t CONFIG_TYPE_FT_SHARED = 0x0007;
const uint32_t CONFIG_TYPE_FT_EXTRA_LIST= 0x0008;
const uint32_t CONFIG_TYPE_FT_CONTROL = 0x0009;
const uint32_t CONFIG_TYPE_FT_DWLQUEUE = 0x000A;
const uint32_t CONFIG_TYPE_P3DISC = 0x000B;
const uint32_t CONFIG_TYPE_AUTHSSL = 0x000C;
/* wish these ids where higher...
* may move when switch to v0.5
*/
const uint32_t CONFIG_TYPE_CHAT = 0x0012;
const uint32_t CONFIG_TYPE_STATUS = 0x0013;
const uint32_t CONFIG_TYPE_PLUGINS = 0x0014;
const uint32_t CONFIG_TYPE_HISTORY = 0x0015;
/// turtle router
const uint32_t CONFIG_TYPE_TURTLE = 0x0020;
/// dht (relay stuff mainly)
const uint32_t CONFIG_TYPE_BITDHT = 0x0030;
/* standard services */
const uint32_t CONFIG_TYPE_QBLOG = 0x0101;
const uint32_t CONFIG_TYPE_FORUMS = 0x0102;
const uint32_t CONFIG_TYPE_CHANNELS = 0x0103;
const uint32_t CONFIG_TYPE_GXS_REPUTATION = 0x0200;
/* CACHE ID Must be at the END so that other configurations
* are loaded First (Cache Config --> Cache Loading)
*/
const uint32_t CONFIG_TYPE_CACHE = 0xff01;
class p3ConfigMgr;
@ -114,7 +76,7 @@ class p3ConfigMgr;
class pqiConfig
{
public:
pqiConfig(uint32_t t);
pqiConfig();
virtual ~pqiConfig();
/**
@ -129,12 +91,6 @@ virtual bool loadConfiguration(RsFileHash &loadHash) = 0;
*/
virtual bool saveConfiguration() = 0;
/**
* The type of configuration, see ids where this class is declared
* @see p3cfgmgr.h
*/
uint32_t Type();
/**
* The name of the configuration file
*/
@ -170,17 +126,13 @@ void setHash(const RsFileHash& h);
Indicator ConfInd;
uint32_t type;
std::string filename;
RsFileHash hash;
friend class p3ConfigMgr;
/* so it can access:
* setFilename() and HasConfigChanged()
*/
};
@ -244,12 +196,12 @@ class p3ConfigMgr
*/
void loadConfig();
const std::string basedir;
const std::string basedir;
RsMutex cfgMtx; /* below is protected */
bool mConfigSaveActive;
std::map<uint32_t, pqiConfig *> configs;
bool mConfigSaveActive;
std::list<pqiConfig *> mConfigs;
};
@ -266,7 +218,7 @@ class p3Config: public pqiConfig
{
public:
p3Config(uint32_t t);
p3Config();
virtual bool loadConfiguration(RsFileHash &loadHash);
virtual bool saveConfiguration();

View file

@ -41,7 +41,7 @@
RsHistory *rsHistory = NULL;
p3HistoryMgr::p3HistoryMgr()
: p3Config(CONFIG_TYPE_HISTORY), mHistoryMtx("p3HistoryMgr")
: p3Config(), mHistoryMtx("p3HistoryMgr")
{
nextMsgId = 1;

View file

@ -109,7 +109,7 @@ std::string textPeerConnectState(peerState &state)
p3PeerMgrIMPL::p3PeerMgrIMPL(const RsPeerId& ssl_own_id, const RsPgpId& gpg_own_id, const std::string& gpg_own_name, const std::string& ssl_own_location)
:p3Config(CONFIG_TYPE_PEERS), mPeerMtx("p3PeerMgr"), mStatusChanged(false)
:p3Config(), mPeerMtx("p3PeerMgr"), mStatusChanged(false)
{
{