summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2018-06-12 09:38:52 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2018-06-12 09:38:52 -0700
commit817b9d012e2d345b77b12537e3857b575941f9c2 (patch)
tree3c00e166df6c2405c260fa2ce651296e59673b28 /node
parentd55c732e1915affd2f40321261bb8178fa28f95a (diff)
parentdce9cb27c1f464cb4a5111c27502d8ca1d7297de (diff)
downloadinfinitytier-817b9d012e2d345b77b12537e3857b575941f9c2.tar.gz
infinitytier-817b9d012e2d345b77b12537e3857b575941f9c2.zip
Merge branch 'dev' of http://10.6.6.2/zerotier/ZeroTierOne into dev
Diffstat (limited to 'node')
-rw-r--r--node/Constants.hpp8
-rw-r--r--node/Switch.cpp3
2 files changed, 11 insertions, 0 deletions
diff --git a/node/Constants.hpp b/node/Constants.hpp
index e2a35dce..03b04e68 100644
--- a/node/Constants.hpp
+++ b/node/Constants.hpp
@@ -194,6 +194,14 @@
#define ZT_RX_QUEUE_SIZE 64
/**
+ * Size of TX queue
+ *
+ * This is about 2mb, and can be decreased for small devices. A queue smaller
+ * than about 4 is probably going to cause a lot of lost packets.
+ */
+#define ZT_TX_QUEUE_SIZE 64
+
+/**
* Length of secret key in bytes -- 256-bit -- do not change
*/
#define ZT_PEER_SECRET_KEY_LENGTH 32
diff --git a/node/Switch.cpp b/node/Switch.cpp
index eb1ebadb..3fa8c31d 100644
--- a/node/Switch.cpp
+++ b/node/Switch.cpp
@@ -503,6 +503,9 @@ void Switch::send(void *tPtr,Packet &packet,bool encrypt)
if (!_trySend(tPtr,packet,encrypt)) {
{
Mutex::Lock _l(_txQueue_m);
+ if (_txQueue.size() >= ZT_TX_QUEUE_SIZE) {
+ _txQueue.pop_front();
+ }
_txQueue.push_back(TXQueueEntry(dest,RR->node->now(),packet,encrypt));
}
if (!RR->topology->getPeer(tPtr,dest))