From 270debb3fc39c3f1f6a3f6fbc2c5fb6183182c8f Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Fri, 1 Mar 2019 13:28:00 -0800 Subject: [PATCH] #ifdef'd out multipath/QoS statistics buffers allocations for ZT_PROTOCOL_VERSION<10 --- node/Path.hpp | 6 ++++-- node/Peer.cpp | 2 ++ node/Peer.hpp | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/node/Path.hpp b/node/Path.hpp index a9e7d84df..6acba1725 100644 --- a/node/Path.hpp +++ b/node/Path.hpp @@ -161,6 +161,7 @@ public: ~Path() { +#if ZT_PROTO_VERSION >= 10 delete _throughputSamples; delete _latencySamples; delete _packetValiditySamples; @@ -169,6 +170,7 @@ public: _latencySamples = NULL; _packetValiditySamples = NULL; _throughputDisturbanceSamples = NULL; +#endif } /** @@ -651,12 +653,14 @@ public: * Initialize statistical buffers */ inline void prepareBuffers() { +#if ZT_PROTO_VERSION >= 10 _throughputSamples = new RingBuffer(ZT_PATH_QUALITY_METRIC_WIN_SZ); _latencySamples = new RingBuffer(ZT_PATH_QUALITY_METRIC_WIN_SZ); _packetValiditySamples = new RingBuffer(ZT_PATH_QUALITY_METRIC_WIN_SZ); _throughputDisturbanceSamples = new RingBuffer(ZT_PATH_QUALITY_METRIC_WIN_SZ); memset(_ifname, 0, 16); memset(_addrString, 0, sizeof(_addrString)); +#endif } private: @@ -702,8 +706,6 @@ private: float _lastComputedThroughputDistCoeff; unsigned char _lastAllocation; - - // cached human-readable strings for tracing purposes char _ifname[16]; char _addrString[256]; diff --git a/node/Peer.cpp b/node/Peer.cpp index aecbd3a04..9f8c5bbca 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -78,7 +78,9 @@ Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Ident Utils::getSecureRandom(&_freeRandomByte, 1); if (!myIdentity.agree(peerIdentity,_key,ZT_PEER_SECRET_KEY_LENGTH)) throw ZT_EXCEPTION_INVALID_ARGUMENT; +#if ZT_PROTO_VERSION >= 10 _pathChoiceHist = new RingBuffer(ZT_MULTIPATH_PROPORTION_WIN_SZ); +#endif } void Peer::received( diff --git a/node/Peer.hpp b/node/Peer.hpp index ae8f1e787..99d3fac26 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -62,7 +62,9 @@ private: public: ~Peer() { Utils::burn(_key,sizeof(_key)); +#if ZT_PROTO_VERSION >= 10 delete _pathChoiceHist; +#endif _pathChoiceHist = NULL; }