mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-18 15:18:17 +00:00
.
This commit is contained in:
@ -46,6 +46,11 @@
|
||||
*/
|
||||
#define ZT_PATH_MAX_PREFERENCE_RANK ((ZT_INETADDRESS_MAX_SCOPE << 1) | 1)
|
||||
|
||||
/**
|
||||
* Maximum distance for a path
|
||||
*/
|
||||
#define ZT_PATH_DISTANCE_MAX 0xffff
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
class RuntimeEnvironment;
|
||||
@ -120,6 +125,7 @@ public:
|
||||
_incomingLinkQualitySlowLogCounter(-64), // discard first fast log
|
||||
_incomingLinkQualityPreviousPacketCounter(0),
|
||||
_outgoingPacketCounter(0),
|
||||
_distance(ZT_PATH_DISTANCE_MAX),
|
||||
_addr(),
|
||||
_localAddress(),
|
||||
_ipScope(InetAddress::IP_SCOPE_NONE)
|
||||
@ -137,6 +143,7 @@ public:
|
||||
_incomingLinkQualitySlowLogCounter(-64), // discard first fast log
|
||||
_incomingLinkQualityPreviousPacketCounter(0),
|
||||
_outgoingPacketCounter(0),
|
||||
_distance(ZT_PATH_DISTANCE_MAX),
|
||||
_addr(addr),
|
||||
_localAddress(localAddress),
|
||||
_ipScope(addr.ipScope())
|
||||
@ -299,6 +306,28 @@ public:
|
||||
*/
|
||||
inline uint64_t lastIn() const { return _lastIn; }
|
||||
|
||||
/**
|
||||
* @return Time last trust-established packet was received
|
||||
*/
|
||||
inline uint64_t lastTrustEstablishedPacketReceived() const { return _lastTrustEstablishedPacketReceived; }
|
||||
|
||||
/**
|
||||
* @return Distance (higher is further)
|
||||
*/
|
||||
inline unsigned int distance() const { return _distance; }
|
||||
|
||||
/**
|
||||
* @param lo Last out send
|
||||
* @param li Last in send
|
||||
* @param lt Last trust established packet received
|
||||
*/
|
||||
inline void updateFromRemoteState(const uint64_t lo,const uint64_t li,const uint64_t lt)
|
||||
{
|
||||
_lastOut = lo;
|
||||
_lastIn = li;
|
||||
_lastTrustEstablishedPacketReceived = lt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return and increment outgoing packet counter (used with Packet::armor())
|
||||
*
|
||||
@ -315,6 +344,7 @@ private:
|
||||
volatile signed int _incomingLinkQualitySlowLogCounter;
|
||||
volatile unsigned int _incomingLinkQualityPreviousPacketCounter;
|
||||
volatile unsigned int _outgoingPacketCounter;
|
||||
volatile unsigned int _distance;
|
||||
InetAddress _addr;
|
||||
InetAddress _localAddress;
|
||||
InetAddress::IpScope _ipScope; // memoize this since it's a computed value checked often
|
||||
|
Reference in New Issue
Block a user