Optimization and cleanup

This commit is contained in:
Adam Ierymenko 2019-08-26 20:18:28 -07:00
parent 8203547cfc
commit 6f22570648
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
17 changed files with 261 additions and 266 deletions

View file

@ -67,7 +67,7 @@ public:
/**
* @return Time we last pushed credentials to this member
*/
inline int64_t lastPushedCredentials() const { return _lastPushedCredentials; }
ZT_ALWAYS_INLINE int64_t lastPushedCredentials() const { return _lastPushedCredentials; }
/**
* Check whether we should push MULTICAST_LIKEs to this peer, and update last sent time if true
@ -75,7 +75,7 @@ public:
* @param now Current time
* @return True if we should update multicasts
*/
inline bool multicastLikeGate(const int64_t now)
ZT_ALWAYS_INLINE bool multicastLikeGate(const int64_t now)
{
if ((now - _lastUpdatedMulticast) >= ZT_MULTICAST_ANNOUNCE_PERIOD) {
_lastUpdatedMulticast = now;
@ -90,7 +90,7 @@ public:
* @param nconf Our network config
* @return True if this peer is allowed on this network at all
*/
inline bool isAllowedOnNetwork(const NetworkConfig &nconf) const
ZT_ALWAYS_INLINE bool isAllowedOnNetwork(const NetworkConfig &nconf) const
{
if (nconf.isPublic()) return true; // public network
if (_com.timestamp() <= _comRevocationThreshold) return false; // COM has been revoked
@ -100,7 +100,7 @@ public:
/**
* @return True if this peer has sent us a valid certificate within ZT_PEER_ACTIVITY_TIMEOUT
*/
inline bool recentlyAssociated(const int64_t now) const { return ((_com)&&((now - _com.timestamp()) < ZT_PEER_ACTIVITY_TIMEOUT)); }
ZT_ALWAYS_INLINE bool recentlyAssociated(const int64_t now) const { return ((_com)&&((now - _com.timestamp()) < ZT_PEER_ACTIVITY_TIMEOUT)); }
/**
* Check whether the peer represented by this Membership owns a given address
@ -160,22 +160,22 @@ public:
/**
* @return Bytes received so far
*/
inline uint64_t receivedBytes() const { return _received; }
ZT_ALWAYS_INLINE uint64_t receivedBytes() const { return _received; }
/**
* @return Bytes sent so far
*/
inline uint64_t sentBytes() const { return _sent; }
ZT_ALWAYS_INLINE uint64_t sentBytes() const { return _sent; }
/**
* @param bytes Bytes received
*/
inline void logReceivedBytes(const unsigned int bytes) { _received = (uint64_t)bytes; }
ZT_ALWAYS_INLINE void logReceivedBytes(const unsigned int bytes) { _received = (uint64_t)bytes; }
/**
* @param bytes Bytes sent
*/
inline void logSentBytes(const unsigned int bytes) { _sent = (uint64_t)bytes; }
ZT_ALWAYS_INLINE void logSentBytes(const unsigned int bytes) { _sent = (uint64_t)bytes; }
private:
// This returns true if a resource is an IPv6 NDP-emulated address. These embed the ZT
@ -275,7 +275,7 @@ public:
class CapabilityIterator
{
public:
inline CapabilityIterator(Membership &m,const NetworkConfig &nconf) :
ZT_ALWAYS_INLINE CapabilityIterator(Membership &m,const NetworkConfig &nconf) :
_hti(m._remoteCaps),
_k((uint32_t *)0),
_c((Capability *)0),
@ -284,7 +284,7 @@ public:
{
}
inline Capability *next()
ZT_ALWAYS_INLINE Capability *next()
{
while (_hti.next(_k,_c)) {
if (_m._isCredentialTimestampValid(_nconf,*_c))