2
0
Adam Ierymenko 6 жил өмнө
parent
commit
087c75d5ee

+ 10 - 15
node/Constants.hpp

@@ -258,11 +258,6 @@
  */
  */
 #define ZT_MULTICAST_EXPLICIT_GATHER_DELAY (ZT_MULTICAST_LIKE_EXPIRE / 10)
 #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
  * 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
  * since we will record a 0 bit/s measurement if no valid latency measurement was made within this
  * window of time.
  * 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.
  * 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
  * 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
  * 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
  * How often a QoS packet is sent
@@ -390,7 +385,7 @@
 /**
 /**
  * How many ID:sojourn time pairs in a single QoS packet
  * 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
  * Maximum number of outgoing packets we monitor for QoS information
@@ -400,12 +395,12 @@
 /**
 /**
  * Timeout for QoS records
  * 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
  * 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
  * Minimum amount of time between each ACK packet

+ 1 - 0
node/IncomingPacket.cpp

@@ -220,6 +220,7 @@ bool IncomingPacket::_doACK(const RuntimeEnvironment *RR,void *tPtr,const Shared
 
 
 	return true;
 	return true;
 }
 }
+
 bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr<Peer> &peer)
 bool IncomingPacket::_doQOS_MEASUREMENT(const RuntimeEnvironment *RR,void *tPtr,const SharedPtr<Peer> &peer)
 {
 {
 	if (!peer->rateGateQoS(RR->node->now()))
 	if (!peer->rateGateQoS(RR->node->now()))

+ 13 - 0
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
 			// 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
 			// Also get networks and whether they need config so we only have to do one pass over networks
 			std::vector< std::pair< SharedPtr<Network>,bool > > networkConfigNeeded;
 			std::vector< std::pair< SharedPtr<Network>,bool > > networkConfigNeeded;