From d5303560556cfae45c07214d1c0379d8a048fa3d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 22 Mar 2019 14:39:52 -0700 Subject: RingBuffer<> is now templated with size, buffer is now static. --- node/Peer.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'node/Peer.cpp') diff --git a/node/Peer.cpp b/node/Peer.cpp index ba8918bc..2ab186c3 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -76,7 +76,6 @@ 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; - _pathChoiceHist = new RingBuffer(ZT_MULTIPATH_PROPORTION_WIN_SZ); } void Peer::received( @@ -471,7 +470,7 @@ SharedPtr Peer::getAppropriatePath(int64_t now, bool includeExpired) if (_paths[i].p) { if (rf < _paths[i].p->allocation()) { bestPath = i; - _pathChoiceHist->push(bestPath); // Record which path we chose + _pathChoiceHist.push(bestPath); // Record which path we chose break; } rf -= _paths[i].p->allocation(); @@ -500,7 +499,7 @@ char *Peer::interfaceListStr() float targetAllocation = 1.0 / alivePathCount; float currentAllocation = 1.0; if (alivePathCount > 1) { - currentAllocation = (float)_pathChoiceHist->countValue(i) / (float)_pathChoiceHist->count(); + currentAllocation = (float)_pathChoiceHist.countValue(i) / (float)_pathChoiceHist.count(); if (fabs(targetAllocation - currentAllocation) > ZT_PATH_IMBALANCE_THRESHOLD) { imbalanced = true; } -- cgit v1.2.3