diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-13 12:53:05 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2019-06-13 12:53:05 -0700 |
| commit | 97975402120d565dd211f9d470e7b192641712c5 (patch) | |
| tree | 9f7a2db5ea4c9568d6b801d52b1fffd857565767 /node/Peer.cpp | |
| parent | ce2338c24a46558a2e0fdb7ebbcf2e6ce9c8b615 (diff) | |
| parent | 3b188ba672559ff80264a8fab32699ebdbf928fe (diff) | |
| download | infinitytier-97975402120d565dd211f9d470e7b192641712c5.tar.gz infinitytier-97975402120d565dd211f9d470e7b192641712c5.zip | |
merge
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index da73e9cb..029e45e7 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -157,7 +157,7 @@ void Peer::received( break; } // If the path is the same address and port, simply assume this is a replacement - if ( (_paths[i].p->address().ipsEqual2(path->address()) && (_paths[i].p->address().port() == path->address().port()))) { + if ( (_paths[i].p->address().ipsEqual2(path->address()))) { replacePath = i; break; } @@ -285,7 +285,7 @@ void Peer::computeAggregateProportionalAllocation(int64_t now) for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { if (_paths[i].p) { relStability[i] = _paths[i].p->lastComputedStability(); - relThroughput[i] = _paths[i].p->maxLifetimeThroughput(); + relThroughput[i] = (float)_paths[i].p->maxLifetimeThroughput(); maxStability = relStability[i] > maxStability ? relStability[i] : maxStability; maxThroughput = relThroughput[i] > maxThroughput ? relThroughput[i] : maxThroughput; maxScope = _paths[i].p->ipScope() > maxScope ? _paths[i].p->ipScope() : maxScope; @@ -296,7 +296,7 @@ void Peer::computeAggregateProportionalAllocation(int64_t now) if (_paths[i].p) { relStability[i] /= maxStability ? maxStability : 1; relThroughput[i] /= maxThroughput ? maxThroughput : 1; - float normalized_ma = Utils::normalize(_paths[i].p->ackAge(now), 0, ZT_PATH_MAX_AGE, 0, 10); + float normalized_ma = Utils::normalize((float)_paths[i].p->ackAge(now), 0, ZT_PATH_MAX_AGE, 0, 10); float age_contrib = exp((-1)*normalized_ma); float relScope = ((float)(_paths[i].p->ipScope()+1) / (maxScope + 1)); float relQuality = @@ -314,7 +314,7 @@ void Peer::computeAggregateProportionalAllocation(int64_t now) // Convert set of relative performances into an allocation set for(uint16_t i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { if (_paths[i].p) { - _paths[i].p->updateComponentAllocationOfAggregateLink((_paths[i].p->relativeQuality() / totalRelativeQuality) * 255); + _paths[i].p->updateComponentAllocationOfAggregateLink((unsigned char)((_paths[i].p->relativeQuality() / totalRelativeQuality) * 255)); } } } @@ -327,7 +327,7 @@ int Peer::computeAggregateLinkPacketDelayVariance() pdv += _paths[i].p->relativeQuality() * _paths[i].p->packetDelayVariance(); } } - return pdv; + return (int)pdv; } int Peer::computeAggregateLinkMeanLatency() @@ -337,7 +337,7 @@ int Peer::computeAggregateLinkMeanLatency() for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { if (_paths[i].p) { pathCount++; - ml += _paths[i].p->relativeQuality() * _paths[i].p->meanLatency(); + ml += (int)(_paths[i].p->relativeQuality() * _paths[i].p->meanLatency()); } } return ml / pathCount; |
