mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-26 05:49:59 +00:00
If lastSend/lastReceive is < 0, just put 0.
This commit is contained in:
parent
099bedd2e9
commit
ceeb35eaac
@ -264,10 +264,12 @@ static void _peerToJson(nlohmann::json &pj,const ZT_Peer *peer)
|
|||||||
|
|
||||||
nlohmann::json pa = nlohmann::json::array();
|
nlohmann::json pa = nlohmann::json::array();
|
||||||
for(unsigned int i=0;i<peer->pathCount;++i) {
|
for(unsigned int i=0;i<peer->pathCount;++i) {
|
||||||
|
int64_t lastSend = peer->paths[i].lastSend;
|
||||||
|
int64_t lastReceive = peer->paths[i].lastReceive;
|
||||||
nlohmann::json j;
|
nlohmann::json j;
|
||||||
j["address"] = reinterpret_cast<const InetAddress *>(&(peer->paths[i].address))->toString(tmp);
|
j["address"] = reinterpret_cast<const InetAddress *>(&(peer->paths[i].address))->toString(tmp);
|
||||||
j["lastSend"] = peer->paths[i].lastSend;
|
j["lastSend"] = (lastSend < 0) ? 0 : lastSend;
|
||||||
j["lastReceive"] = peer->paths[i].lastReceive;
|
j["lastReceive"] = (lastReceive < 0) ? 0 : lastReceive;
|
||||||
j["trustedPathId"] = peer->paths[i].trustedPathId;
|
j["trustedPathId"] = peer->paths[i].trustedPathId;
|
||||||
j["linkQuality"] = (double)peer->paths[i].linkQuality / (double)ZT_PATH_LINK_QUALITY_MAX;
|
j["linkQuality"] = (double)peer->paths[i].linkQuality / (double)ZT_PATH_LINK_QUALITY_MAX;
|
||||||
j["active"] = (bool)(peer->paths[i].expired == 0);
|
j["active"] = (bool)(peer->paths[i].expired == 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user