Minor fixes.

This commit is contained in:
Adam Ierymenko 2016-11-08 00:05:18 +00:00
parent 4868d21526
commit 360c84e035
2 changed files with 5 additions and 3 deletions

View File

@ -1508,20 +1508,22 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
Mutex::Lock _l(_db_m);
json member = _db.get("network",nwids,"member",Address(address).toString(),0);
if (!member.size())
return 404;
_db.erase("network",nwids,"member",Address(address).toString());
if (!member.size())
return 404;
responseBody = member.dump(2);
responseContentType = "application/json";
return 200;
}
} else {
Mutex::Lock _l(_db_m);
std::string pfx("network/"); pfx.append(nwids);
_db.filter(pfx,120000,[](const std::string &n,const json &obj) {
return false; // delete
});
responseBody = network.dump(2);
responseContentType = "application/json";
return 200;

View File

@ -79,7 +79,7 @@ public:
{
for(std::map<std::string,_E>::iterator i(_db.lower_bound(prefix));i!=_db.end();) {
if ((i->first.length() >= prefix.length())&&(!memcmp(i->first.data(),prefix.data(),prefix.length()))) {
if (!func(i->first,get(i->second.obj,maxSinceCheck))) {
if (!func(i->first,get(i->first,maxSinceCheck))) {
std::map<std::string,_E>::iterator i2(i); ++i2;
this->erase(i->first);
i = i2;