From 360c84e0351728b0c0479ceddba924997acb46e4 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 8 Nov 2016 00:05:18 +0000 Subject: [PATCH] Minor fixes. --- controller/EmbeddedNetworkController.cpp | 6 ++++-- controller/JSONDB.hpp | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/controller/EmbeddedNetworkController.cpp b/controller/EmbeddedNetworkController.cpp index d60bde984..85717e28b 100644 --- a/controller/EmbeddedNetworkController.cpp +++ b/controller/EmbeddedNetworkController.cpp @@ -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; diff --git a/controller/JSONDB.hpp b/controller/JSONDB.hpp index a9a5e6acf..bd1ae5a56 100644 --- a/controller/JSONDB.hpp +++ b/controller/JSONDB.hpp @@ -79,7 +79,7 @@ public: { for(std::map::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::iterator i2(i); ++i2; this->erase(i->first); i = i2;