summaryrefslogtreecommitdiff
path: root/controller/EmbeddedNetworkController.hpp
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2017-10-02 15:52:57 -0700
committerGrant Limberg <grant.limberg@zerotier.com>2017-10-02 15:52:57 -0700
commitb1d60df44cb24589bc5718da932ef4bb54168fa3 (patch)
treec240b5b626f534f4a3673bedbdf6d80b59a8d475 /controller/EmbeddedNetworkController.hpp
parent7cf70d111ac3bfc1bf6aa7e3ec8d9c83e35f48a1 (diff)
downloadinfinitytier-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 'controller/EmbeddedNetworkController.hpp')
-rw-r--r--controller/EmbeddedNetworkController.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/controller/EmbeddedNetworkController.hpp b/controller/EmbeddedNetworkController.hpp
index 19469164..fce56065 100644
--- a/controller/EmbeddedNetworkController.hpp
+++ b/controller/EmbeddedNetworkController.hpp
@@ -166,7 +166,7 @@ private:
}
network["objtype"] = "network";
}
- inline void _addNetworkNonPersistedFields(nlohmann::json &network,uint64_t now,const JSONDB::NetworkSummaryInfo &ns)
+ inline void _addNetworkNonPersistedFields(nlohmann::json &network,int64_t now,const JSONDB::NetworkSummaryInfo &ns)
{
network["clock"] = now;
network["authorizedMemberCount"] = ns.authorizedMemberCount;
@@ -182,7 +182,7 @@ private:
// legacy fields
network.erase("lastModified");
}
- inline void _addMemberNonPersistedFields(uint64_t nwid,uint64_t nodeId,nlohmann::json &member,uint64_t now)
+ inline void _addMemberNonPersistedFields(uint64_t nwid,uint64_t nodeId,nlohmann::json &member,int64_t now)
{
member["clock"] = now;
Mutex::Lock _l(_memberStatus_m);
@@ -197,7 +197,7 @@ private:
member.erase("lastRequestMetaData");
}
- const uint64_t _startTime;
+ const int64_t _startTime;
volatile bool _running;
BlockingQueue<_RQEntry *> _queue;
@@ -230,7 +230,7 @@ private:
Dictionary<ZT_NETWORKCONFIG_METADATA_DICT_CAPACITY> lastRequestMetaData;
Identity identity;
InetAddress physicalAddr; // last known physical address
- inline bool online(const uint64_t now) const { return ((now - lastRequestTime) < (ZT_NETWORK_AUTOCONF_DELAY * 2)); }
+ inline bool online(const int64_t now) const { return ((now - lastRequestTime) < (ZT_NETWORK_AUTOCONF_DELAY * 2)); }
};
struct _MemberStatusHash
{