mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-31 00:23:58 +00:00
Minor fixes.
This commit is contained in:
parent
4868d21526
commit
360c84e035
@ -1508,20 +1508,22 @@ unsigned int EmbeddedNetworkController::handleControlPlaneHttpDELETE(
|
|||||||
Mutex::Lock _l(_db_m);
|
Mutex::Lock _l(_db_m);
|
||||||
|
|
||||||
json member = _db.get("network",nwids,"member",Address(address).toString(),0);
|
json member = _db.get("network",nwids,"member",Address(address).toString(),0);
|
||||||
if (!member.size())
|
|
||||||
return 404;
|
|
||||||
_db.erase("network",nwids,"member",Address(address).toString());
|
_db.erase("network",nwids,"member",Address(address).toString());
|
||||||
|
|
||||||
|
if (!member.size())
|
||||||
|
return 404;
|
||||||
responseBody = member.dump(2);
|
responseBody = member.dump(2);
|
||||||
responseContentType = "application/json";
|
responseContentType = "application/json";
|
||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Mutex::Lock _l(_db_m);
|
Mutex::Lock _l(_db_m);
|
||||||
|
|
||||||
std::string pfx("network/"); pfx.append(nwids);
|
std::string pfx("network/"); pfx.append(nwids);
|
||||||
_db.filter(pfx,120000,[](const std::string &n,const json &obj) {
|
_db.filter(pfx,120000,[](const std::string &n,const json &obj) {
|
||||||
return false; // delete
|
return false; // delete
|
||||||
});
|
});
|
||||||
|
|
||||||
responseBody = network.dump(2);
|
responseBody = network.dump(2);
|
||||||
responseContentType = "application/json";
|
responseContentType = "application/json";
|
||||||
return 200;
|
return 200;
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
{
|
{
|
||||||
for(std::map<std::string,_E>::iterator i(_db.lower_bound(prefix));i!=_db.end();) {
|
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 ((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;
|
std::map<std::string,_E>::iterator i2(i); ++i2;
|
||||||
this->erase(i->first);
|
this->erase(i->first);
|
||||||
i = i2;
|
i = i2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user