Starting in on Switch... kill map in defrag queue, which will probably improve performance pretty decently under high load with lots of peers.

This commit is contained in:
Adam Ierymenko 2015-09-04 14:44:22 -07:00
parent f116c4b9c0
commit 0ab3e49be9
3 changed files with 35 additions and 27 deletions

View file

@ -45,6 +45,7 @@
#include "Network.hpp"
#include "SharedPtr.hpp"
#include "IncomingPacket.hpp"
#include "Hashtable.hpp"
/* Ethernet frame types that might be relevant to us */
#define ZT_ETHERTYPE_IPV4 0x0800
@ -199,13 +200,14 @@ private:
// Packet defragmentation queue -- comes before RX queue in path
struct DefragQueueEntry
{
DefragQueueEntry() : creationTime(0),totalFragments(0),haveFragments(0) {}
uint64_t creationTime;
SharedPtr<IncomingPacket> frag0;
Packet::Fragment frags[ZT_MAX_PACKET_FRAGMENTS - 1];
unsigned int totalFragments; // 0 if only frag0 received, waiting for frags
uint32_t haveFragments; // bit mask, LSB to MSB
};
std::map< uint64_t,DefragQueueEntry > _defragQueue;
Hashtable< uint64_t,DefragQueueEntry > _defragQueue;
Mutex _defragQueue_m;
// ZeroTier-layer RX queue of incoming packets in the process of being decoded