summaryrefslogtreecommitdiff
path: root/node/DeferredPackets.hpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-03-18 14:16:07 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-03-18 14:16:07 -0700
commitd6a1868d0a9b1d65417b87a20a4e234903d290f1 (patch)
treed746260c0f2fa6b3df52a0a8fa478f13d0b903de /node/DeferredPackets.hpp
parent9f31cbd8b8f68d52dd02ebe002d9713811c37864 (diff)
downloadinfinitytier-d6a1868d0a9b1d65417b87a20a4e234903d290f1.tar.gz
infinitytier-d6a1868d0a9b1d65417b87a20a4e234903d290f1.zip
Refactor incoming packet (rxQueue/fragmentQueue) to eliminate variable length queues and merge queues. This is both faster and saves memory.
Diffstat (limited to 'node/DeferredPackets.hpp')
-rw-r--r--node/DeferredPackets.hpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/node/DeferredPackets.hpp b/node/DeferredPackets.hpp
index 5ba26531..a9855396 100644
--- a/node/DeferredPackets.hpp
+++ b/node/DeferredPackets.hpp
@@ -19,6 +19,8 @@
#ifndef ZT_DEFERREDPACKETS_HPP
#define ZT_DEFERREDPACKETS_HPP
+#include <list>
+
#include "Constants.hpp"
#include "SharedPtr.hpp"
#include "Mutex.hpp"
@@ -28,7 +30,7 @@
/**
* Maximum number of deferred packets
*/
-#define ZT_DEFFEREDPACKETS_MAX 1024
+#define ZT_DEFFEREDPACKETS_MAX 256
namespace ZeroTier {
@@ -53,11 +55,6 @@ public:
/**
* Enqueue a packet
*
- * Since packets enqueue themselves, they call it with 'this' and we wrap
- * them in a SharedPtr<>. This is safe as SharedPtr<> is introspective and
- * supports this. This should not be called from any other code outside
- * IncomingPacket.
- *
* @param pkt Packet to process later (possibly in the background)
* @return False if queue is full
*/
@@ -75,10 +72,8 @@ public:
int process();
private:
- SharedPtr<IncomingPacket> _q[ZT_DEFFEREDPACKETS_MAX];
+ std::list<IncomingPacket> _q;
const RuntimeEnvironment *const RR;
- unsigned long _readPtr;
- unsigned long _writePtr;
volatile int _waiting;
volatile bool _die;
Mutex _q_m;