Reduce memory use and a bit of cleanup.

This commit is contained in:
Adam Ierymenko 2017-04-27 19:36:03 -07:00
parent 9e80db0fd1
commit 62578a2162
4 changed files with 67 additions and 43 deletions

View file

@ -99,9 +99,9 @@ public:
Mutex::Lock _l(_networks_m);
std::unordered_map<uint64_t,_NW>::const_iterator i(_networks.find(networkId));
if (i != _networks.end()) {
for(std::unordered_map<uint64_t,nlohmann::json>::const_iterator m(i->second.members.begin());m!=i->second.members.end();++m) {
for(std::unordered_map< uint64_t,std::vector<uint8_t> >::const_iterator m(i->second.members.begin());m!=i->second.members.end();++m) {
try {
func(networkId,m->first,m->second);
func(networkId,m->first,nlohmann::json::from_msgpack(m->second));
} catch ( ... ) {}
}
}
@ -126,10 +126,10 @@ private:
struct _NW
{
_NW() : summaryInfoLastComputed(0) {}
nlohmann::json config;
std::vector<uint8_t> config;
NetworkSummaryInfo summaryInfo;
uint64_t summaryInfoLastComputed;
std::unordered_map<uint64_t,nlohmann::json> members;
std::unordered_map< uint64_t,std::vector<uint8_t> > members;
};
std::unordered_map<uint64_t,_NW> _networks;