Code cleanup, and fix some unsafe pointer handling in Network.

This commit is contained in:
Adam Ierymenko 2014-10-29 13:57:37 -07:00
parent f65b48d447
commit 95f421024a
10 changed files with 86 additions and 97 deletions

View file

@ -145,7 +145,7 @@ public:
inline bool hasNetwork(uint64_t nwid)
{
Mutex::Lock _l(_networks_m);
return (_networks.count(nwid) > 0);
return (_networks.find(nwid) != _networks.end());
}
/**
@ -163,12 +163,15 @@ public:
return tapDevs;
}
private:
void _readLocalConfig();
void _writeLocalConfig();
const RuntimeEnvironment *RR;
Dictionary _localConfig; // persisted as local.conf
Mutex _localConfig_m;
std::map< uint64_t,SharedPtr<Network> > _networks; // persisted in networks.d/
Mutex _networks_m;
};