Optimized startup of RetroShare by removing two unnecessary calls to AuthGPGimpl::storeAllKeys.

Fixed small hangs of RetroShare by removing the core lock in RsServer::ConfigGetDataRates. Is that needed?

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4725 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-12-12 09:37:03 +00:00
parent ef57cd44b3
commit e150e31401
5 changed files with 54 additions and 23 deletions

View file

@ -362,19 +362,35 @@ void p3ConfigMgr::loadConfig()
{
std::map<uint32_t, pqiConfig *>::iterator cit;
std::string dummyHash = "dummyHash";
for (cit = configs.begin(); cit != configs.end(); cit++)
{
// step 0 -> load CONFIG_TYPE_AUTHGPG
// step 1 -> load all other
for (int step = 0; step < 2; ++step) {
for (cit = configs.begin(); cit != configs.end(); cit++)
{
if ((step == 0 && cit->first != CONFIG_TYPE_AUTHGPG) ||
(step == 1 && cit->first == CONFIG_TYPE_AUTHGPG)) {
// don't load configuration
continue;
}
#ifdef CONFIG_DEBUG
std::cerr << "p3ConfigMgr::loadConfig() Element: ";
std::cerr << cit->first <<"Dummy Hash: " << dummyHash;
std::cerr << std::endl;
std::cerr << "p3ConfigMgr::loadConfig() Element: ";
std::cerr << cit->first <<"Dummy Hash: " << dummyHash;
std::cerr << std::endl;
#endif
cit->second->loadConfiguration(dummyHash);
cit->second->loadConfiguration(dummyHash);
/* force config to NOT CHANGED */
cit->second->HasConfigChanged(0);
cit->second->HasConfigChanged(1);
/* force config to NOT CHANGED */
cit->second->HasConfigChanged(0);
cit->second->HasConfigChanged(1);
if (step == 0) {
// CONFIG_TYPE_AUTHGPG loaded
break;
}
}
}
return;
@ -1335,13 +1351,13 @@ bool pqiConfig::HasConfigChanged(uint16_t idx)
return ConfInd.Changed(idx);
}
void pqiConfig::setFilename(std::string name)
void pqiConfig::setFilename(const std::string& name)
{
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
filename = name;
}
void pqiConfig::setHash(std::string h)
void pqiConfig::setHash(const std::string& h)
{
RsStackMutex stack(cfgMtx); /***** LOCK STACK MUTEX ****/
hash = h;