summaryrefslogtreecommitdiff
path: root/node/Peer.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2019-06-17 13:32:41 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2019-06-17 13:32:41 -0700
commit9c51ce9c40c1eadd20e943f74f0694a0a6a05ae1 (patch)
tree52c89b89aa45a5843b20ca668af415d90a6afe29 /node/Peer.cpp
parent97975402120d565dd211f9d470e7b192641712c5 (diff)
downloadinfinitytier-9c51ce9c40c1eadd20e943f74f0694a0a6a05ae1.tar.gz
infinitytier-9c51ce9c40c1eadd20e943f74f0694a0a6a05ae1.zip
Windows build fixes, fix double/float types to get rid of warnings.
Diffstat (limited to 'node/Peer.cpp')
-rw-r--r--node/Peer.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 029e45e7..a053ee48 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -300,13 +300,13 @@ void Peer::computeAggregateProportionalAllocation(int64_t now)
float age_contrib = exp((-1)*normalized_ma);
float relScope = ((float)(_paths[i].p->ipScope()+1) / (maxScope + 1));
float relQuality =
- (relStability[i] * ZT_PATH_CONTRIB_STABILITY)
- + (fmax(1, relThroughput[i]) * ZT_PATH_CONTRIB_THROUGHPUT)
- + relScope * ZT_PATH_CONTRIB_SCOPE;
+ (relStability[i] * (float)ZT_PATH_CONTRIB_STABILITY)
+ + (fmaxf(1.0f, relThroughput[i]) * (float)ZT_PATH_CONTRIB_THROUGHPUT)
+ + relScope * (float)ZT_PATH_CONTRIB_SCOPE;
relQuality *= age_contrib;
// Arbitrary cutoffs
- relQuality = relQuality > (1.00 / 100.0) ? relQuality : 0.0;
- relQuality = relQuality < (99.0 / 100.0) ? relQuality : 1.0;
+ relQuality = relQuality > (1.00f / 100.0f) ? relQuality : 0.0f;
+ relQuality = relQuality < (99.0f / 100.0f) ? relQuality : 1.0f;
totalRelativeQuality += relQuality;
_paths[i].p->updateRelativeQuality(relQuality);
}
@@ -479,8 +479,8 @@ char *Peer::interfaceListStr()
if (_paths[i].p && _paths[i].p->alive(now)) {
int ipv = _paths[i].p->address().isV4();
// If this is acting as an aggregate link, check allocations
- float targetAllocation = 1.0 / alivePathCount;
- float currentAllocation = 1.0;
+ float targetAllocation = 1.0f / (float)alivePathCount;
+ float currentAllocation = 1.0f;
if (alivePathCount > 1) {
currentAllocation = (float)_pathChoiceHist.countValue(i) / (float)_pathChoiceHist.count();
if (fabs(targetAllocation - currentAllocation) > ZT_PATH_IMBALANCE_THRESHOLD) {