mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-15 13:48:16 +00:00
Added TX queue cap for issue #769
This commit is contained in:
@ -193,6 +193,14 @@
|
|||||||
*/
|
*/
|
||||||
#define ZT_RX_QUEUE_SIZE 64
|
#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
|
* Length of secret key in bytes -- 256-bit -- do not change
|
||||||
*/
|
*/
|
||||||
|
@ -503,6 +503,9 @@ void Switch::send(void *tPtr,Packet &packet,bool encrypt)
|
|||||||
if (!_trySend(tPtr,packet,encrypt)) {
|
if (!_trySend(tPtr,packet,encrypt)) {
|
||||||
{
|
{
|
||||||
Mutex::Lock _l(_txQueue_m);
|
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));
|
_txQueue.push_back(TXQueueEntry(dest,RR->node->now(),packet,encrypt));
|
||||||
}
|
}
|
||||||
if (!RR->topology->getPeer(tPtr,dest))
|
if (!RR->topology->getPeer(tPtr,dest))
|
||||||
|
Reference in New Issue
Block a user