diff --git a/node/Constants.hpp b/node/Constants.hpp index d85e93a70..c7ebe3472 100644 --- a/node/Constants.hpp +++ b/node/Constants.hpp @@ -258,11 +258,6 @@ */ #define ZT_MULTICAST_EXPLICIT_GATHER_DELAY (ZT_MULTICAST_LIKE_EXPIRE / 10) -/** - * Expiration for credentials presented for MULTICAST_LIKE or MULTICAST_GATHER (for non-network-members) - */ -#define ZT_MULTICAST_CREDENTIAL_EXPIRATON ZT_MULTICAST_LIKE_EXPIRE - /** * Timeout for outgoing multicasts * @@ -328,7 +323,7 @@ * since we will record a 0 bit/s measurement if no valid latency measurement was made within this * window of time. */ -#define ZT_PATH_LATENCY_SAMPLE_INTERVAL ZT_MULTIPATH_PEER_PING_PERIOD * 2 +#define ZT_PATH_LATENCY_SAMPLE_INTERVAL (ZT_MULTIPATH_PEER_PING_PERIOD * 2) /** * Interval used for rate-limiting the computation of path quality estimates. @@ -365,16 +360,16 @@ /** * How much each factor contributes to the "stability" score of a path */ -#define ZT_PATH_CONTRIB_PDV 1.0 / 3.0 -#define ZT_PATH_CONTRIB_LATENCY 1.0 / 3.0 -#define ZT_PATH_CONTRIB_THROUGHPUT_DISTURBANCE 1.0 / 3.0 +#define ZT_PATH_CONTRIB_PDV (1.0 / 3.0) +#define ZT_PATH_CONTRIB_LATENCY (1.0 / 3.0) +#define ZT_PATH_CONTRIB_THROUGHPUT_DISTURBANCE (1.0 / 3.0) /** * How much each factor contributes to the "quality" score of a path */ -#define ZT_PATH_CONTRIB_STABILITY 0.75 / 3.0 -#define ZT_PATH_CONTRIB_THROUGHPUT 1.50 / 3.0 -#define ZT_PATH_CONTRIB_SCOPE 0.75 / 3.0 +#define ZT_PATH_CONTRIB_STABILITY (0.75 / 3.0) +#define ZT_PATH_CONTRIB_THROUGHPUT (1.50 / 3.0) +#define ZT_PATH_CONTRIB_SCOPE (0.75 / 3.0) /** * How often a QoS packet is sent @@ -390,7 +385,7 @@ /** * How many ID:sojourn time pairs in a single QoS packet */ -#define ZT_PATH_QOS_TABLE_SIZE (ZT_PATH_MAX_QOS_PACKET_SZ * 8) / (64 + 16) +#define ZT_PATH_QOS_TABLE_SIZE ((ZT_PATH_MAX_QOS_PACKET_SZ * 8) / (64 + 16)) /** * Maximum number of outgoing packets we monitor for QoS information @@ -400,12 +395,12 @@ /** * Timeout for QoS records */ -#define ZT_PATH_QOS_TIMEOUT ZT_PATH_QOS_INTERVAL * 2 +#define ZT_PATH_QOS_TIMEOUT (ZT_PATH_QOS_INTERVAL * 2) /** * How often the service tests the path throughput */ -#define ZT_PATH_THROUGHPUT_MEASUREMENT_INTERVAL ZT_PATH_ACK_INTERVAL * 8 +#define ZT_PATH_THROUGHPUT_MEASUREMENT_INTERVAL (ZT_PATH_ACK_INTERVAL * 8) /** * Minimum amount of time between each ACK packet diff --git a/node/IncomingPacket.cpp b/node/IncomingPacket.cpp index 5605d2b95..2ee56af8c 100644 --- a/node/IncomingPacket.cpp +++ b/node/IncomingPacket.cpp @@ -220,6 +220,7 @@ bool IncomingPacket::_doACK(const RuntimeEnvironment *RR,void *tPtr,const Shared return true; } + bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr &peer) { if (!peer->rateGateQoS(RR->node->now())) diff --git a/node/Node.cpp b/node/Node.cpp index 1a1f903d0..54cbd5033 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -281,6 +281,19 @@ ZT_ResultCode Node::processBackgroundTasks(void *tptr,int64_t now,volatile int64 } } + // Clean up any old local controller auth memorizations. + { + _localControllerAuthorizations_m.lock(); + Hashtable< _LocalControllerAuth,int64_t >::Iterator i(_localControllerAuthorizations); + _LocalControllerAuth *k = (_LocalControllerAuth *)0; + int64_t *v = (int64_t *)0; + while (i.next(k,v)) { + if ((*v - now) > (ZT_NETWORK_AUTOCONF_DELAY * 3)) + _localControllerAuthorizations.erase(*k); + } + _localControllerAuthorizations_m.unlock(); + } + // Get peers we should stay connected to according to network configs // Also get networks and whether they need config so we only have to do one pass over networks std::vector< std::pair< SharedPtr,bool > > networkConfigNeeded;