mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
Improve CLI error handling when showing non-existent bond
This commit is contained in:
parent
364ac499eb
commit
9724e04e6e
@ -1663,6 +1663,7 @@ public:
|
|||||||
|
|
||||||
ZT_PeerList *pl = _node->peers();
|
ZT_PeerList *pl = _node->peers();
|
||||||
if (pl) {
|
if (pl) {
|
||||||
|
bool foundBond = false;
|
||||||
auto id = req.matches[1];
|
auto id = req.matches[1];
|
||||||
auto out = json::object();
|
auto out = json::object();
|
||||||
uint64_t wantp = Utils::hexStrToU64(id.str().c_str());
|
uint64_t wantp = Utils::hexStrToU64(id.str().c_str());
|
||||||
@ -1672,12 +1673,18 @@ public:
|
|||||||
if (bond) {
|
if (bond) {
|
||||||
_peerToJson(out,&(pl->peers[i]),bond,(_tcpFallbackTunnel != (TcpConnection *)0));
|
_peerToJson(out,&(pl->peers[i]),bond,(_tcpFallbackTunnel != (TcpConnection *)0));
|
||||||
setContent(req, res, out.dump());
|
setContent(req, res, out.dump());
|
||||||
|
foundBond = true;
|
||||||
} else {
|
} else {
|
||||||
setContent(req, res, "");
|
setContent(req, res, "");
|
||||||
res.status = 400;
|
res.status = 400;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!foundBond) {
|
||||||
|
setContent(req, res, "");
|
||||||
|
res.status = 400;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_node->freeQueryResult((void *)pl);
|
_node->freeQueryResult((void *)pl);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user