diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2017-10-05 13:19:25 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2017-10-05 13:19:25 -0700 |
commit | ceeb35eaac083c1557691f7b814a0bf1af587883 (patch) | |
tree | acfec2a76f0ed253dcea462622f9ac47e11d45ba | |
parent | 099bedd2e925a489d59fd4ecca59813944887f5f (diff) | |
download | infinitytier-ceeb35eaac083c1557691f7b814a0bf1af587883.tar.gz infinitytier-ceeb35eaac083c1557691f7b814a0bf1af587883.zip |
If lastSend/lastReceive is < 0, just put 0.
-rw-r--r-- | service/OneService.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 9ab78385..f366efd4 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -264,10 +264,12 @@ static void _peerToJson(nlohmann::json &pj,const ZT_Peer *peer) nlohmann::json pa = nlohmann::json::array(); 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; j["address"] = reinterpret_cast<const InetAddress *>(&(peer->paths[i].address))->toString(tmp); - j["lastSend"] = peer->paths[i].lastSend; - j["lastReceive"] = peer->paths[i].lastReceive; + j["lastSend"] = (lastSend < 0) ? 0 : lastSend; + j["lastReceive"] = (lastReceive < 0) ? 0 : lastReceive; j["trustedPathId"] = peer->paths[i].trustedPathId; j["linkQuality"] = (double)peer->paths[i].linkQuality / (double)ZT_PATH_LINK_QUALITY_MAX; j["active"] = (bool)(peer->paths[i].expired == 0); |