diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-03-22 14:39:52 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-03-22 14:39:52 -0700 |
| commit | d5303560556cfae45c07214d1c0379d8a048fa3d (patch) | |
| tree | 992a594ab832da0265c356d3aa99e8125194f815 /node/Peer.cpp | |
| parent | af3ec000a00d6054006dce7f5cc21bb352358df7 (diff) | |
| download | infinitytier-d5303560556cfae45c07214d1c0379d8a048fa3d.tar.gz infinitytier-d5303560556cfae45c07214d1c0379d8a048fa3d.zip | |
RingBuffer<> is now templated with size, buffer is now static.
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
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<int>(ZT_MULTIPATH_PROPORTION_WIN_SZ); } void Peer::received( @@ -471,7 +470,7 @@ SharedPtr<Path> 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; } |
