diff options
author | Grant Limberg <grant.limberg@zerotier.com> | 2017-10-02 15:52:57 -0700 |
---|---|---|
committer | Grant Limberg <grant.limberg@zerotier.com> | 2017-10-02 15:52:57 -0700 |
commit | b1d60df44cb24589bc5718da932ef4bb54168fa3 (patch) | |
tree | c240b5b626f534f4a3673bedbdf6d80b59a8d475 /one.cpp | |
parent | 7cf70d111ac3bfc1bf6aa7e3ec8d9c83e35f48a1 (diff) | |
download | infinitytier-b1d60df44cb24589bc5718da932ef4bb54168fa3.tar.gz infinitytier-b1d60df44cb24589bc5718da932ef4bb54168fa3.zip |
timestamps changed from uint64_t to int64_t
There were cases in the code where time calculations and comparisons were overflowing and causing connection instability. This will keep time calculations within expected ranges.
Diffstat (limited to 'one.cpp')
-rw-r--r-- | one.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -364,9 +364,9 @@ static int cli(int argc,char **argv) if (path["preferred"]) { char tmp[256]; std::string addr = path["address"]; - const uint64_t now = OSUtils::now(); + const int64_t now = OSUtils::now(); const double lq = (path.count("linkQuality")) ? (double)path["linkQuality"] : -1.0; - OSUtils::ztsnprintf(tmp,sizeof(tmp),"%s;%llu;%llu;%1.2f",addr.c_str(),now - (uint64_t)path["lastSend"],now - (uint64_t)path["lastReceive"],lq); + OSUtils::ztsnprintf(tmp,sizeof(tmp),"%s;%lld;%lld;%1.2f",addr.c_str(),now - (int64_t)path["lastSend"],now - (int64_t)path["lastReceive"],lq); bestPath = tmp; break; } @@ -864,7 +864,7 @@ static int idtool(int argc,char **argv) } std::sort(roots.begin(),roots.end()); - const uint64_t now = OSUtils::now(); + const int64_t now = OSUtils::now(); World w(World::make(t,id,now,updatesMustBeSignedBy,roots,signingKey)); Buffer<ZT_WORLD_MAX_SERIALIZED_LENGTH> wbuf; w.serialize(wbuf); |