summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2019-03-14 16:40:22 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2019-03-14 16:40:22 -0700
commit087c75d5eebea46be5a877dbd22c2362ad0a9051 (patch)
tree008de7a41f04929756121d2903dda350bd324389
parente03102dbcb4d28cfa54740a8d9824d3c6324d97b (diff)
downloadinfinitytier-087c75d5eebea46be5a877dbd22c2362ad0a9051.tar.gz
infinitytier-087c75d5eebea46be5a877dbd22c2362ad0a9051.zip
More cleanup.
-rw-r--r--node/Constants.hpp25
-rw-r--r--node/IncomingPacket.cpp1
-rw-r--r--node/Node.cpp13
3 files changed, 24 insertions, 15 deletions
diff --git a/node/Constants.hpp b/node/Constants.hpp
index d85e93a7..c7ebe347 100644
--- a/node/Constants.hpp
+++ b/node/Constants.hpp
@@ -259,11 +259,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
*
* This is how long we wait for explicit or implicit gather results.
@@ -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 5605d2b9..2ee56af8 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> &peer)
{
if (!peer->rateGateQoS(RR->node->now()))
diff --git a/node/Node.cpp b/node/Node.cpp
index 1a1f903d..54cbd503 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<Network>,bool > > networkConfigNeeded;