mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
Windows build fixes, fix double/float types to get rid of warnings.
This commit is contained in:
parent
9797540212
commit
9c51ce9c40
5 changed files with 28 additions and 12 deletions
|
@ -440,7 +440,7 @@ public:
|
||||||
uint64_t id = it->first;
|
uint64_t id = it->first;
|
||||||
memcpy(qosBuffer, &id, sizeof(uint64_t));
|
memcpy(qosBuffer, &id, sizeof(uint64_t));
|
||||||
qosBuffer+=sizeof(uint64_t);
|
qosBuffer+=sizeof(uint64_t);
|
||||||
uint16_t holdingTime = (now - it->second);
|
uint16_t holdingTime = (uint16_t)(now - it->second);
|
||||||
memcpy(qosBuffer, &holdingTime, sizeof(uint16_t));
|
memcpy(qosBuffer, &holdingTime, sizeof(uint16_t));
|
||||||
qosBuffer+=sizeof(uint16_t);
|
qosBuffer+=sizeof(uint16_t);
|
||||||
len+=sizeof(uint64_t)+sizeof(uint16_t);
|
len+=sizeof(uint64_t)+sizeof(uint16_t);
|
||||||
|
@ -592,11 +592,11 @@ public:
|
||||||
float throughput_cv = _throughputSamples.mean() > 0 ? _throughputSamples.stddev() / _throughputSamples.mean() : 1;
|
float throughput_cv = _throughputSamples.mean() > 0 ? _throughputSamples.stddev() / _throughputSamples.mean() : 1;
|
||||||
|
|
||||||
// Form an exponential cutoff and apply contribution weights
|
// Form an exponential cutoff and apply contribution weights
|
||||||
float pdv_contrib = exp((-1)*normalized_pdv) * ZT_PATH_CONTRIB_PDV;
|
float pdv_contrib = expf((-1.0f)*normalized_pdv) * (float)ZT_PATH_CONTRIB_PDV;
|
||||||
float latency_contrib = exp((-1)*normalized_la) * ZT_PATH_CONTRIB_LATENCY;
|
float latency_contrib = expf((-1.0f)*normalized_la) * (float)ZT_PATH_CONTRIB_LATENCY;
|
||||||
|
|
||||||
// Throughput Disturbance Coefficient
|
// Throughput Disturbance Coefficient
|
||||||
float throughput_disturbance_contrib = exp((-1)*throughput_cv) * ZT_PATH_CONTRIB_THROUGHPUT_DISTURBANCE;
|
float throughput_disturbance_contrib = expf((-1.0f)*throughput_cv) * (float)ZT_PATH_CONTRIB_THROUGHPUT_DISTURBANCE;
|
||||||
_throughputDisturbanceSamples.push(throughput_cv);
|
_throughputDisturbanceSamples.push(throughput_cv);
|
||||||
_lastComputedThroughputDistCoeff = _throughputDisturbanceSamples.mean();
|
_lastComputedThroughputDistCoeff = _throughputDisturbanceSamples.mean();
|
||||||
|
|
||||||
|
|
|
@ -300,13 +300,13 @@ void Peer::computeAggregateProportionalAllocation(int64_t now)
|
||||||
float age_contrib = exp((-1)*normalized_ma);
|
float age_contrib = exp((-1)*normalized_ma);
|
||||||
float relScope = ((float)(_paths[i].p->ipScope()+1) / (maxScope + 1));
|
float relScope = ((float)(_paths[i].p->ipScope()+1) / (maxScope + 1));
|
||||||
float relQuality =
|
float relQuality =
|
||||||
(relStability[i] * ZT_PATH_CONTRIB_STABILITY)
|
(relStability[i] * (float)ZT_PATH_CONTRIB_STABILITY)
|
||||||
+ (fmax(1, relThroughput[i]) * ZT_PATH_CONTRIB_THROUGHPUT)
|
+ (fmaxf(1.0f, relThroughput[i]) * (float)ZT_PATH_CONTRIB_THROUGHPUT)
|
||||||
+ relScope * ZT_PATH_CONTRIB_SCOPE;
|
+ relScope * (float)ZT_PATH_CONTRIB_SCOPE;
|
||||||
relQuality *= age_contrib;
|
relQuality *= age_contrib;
|
||||||
// Arbitrary cutoffs
|
// Arbitrary cutoffs
|
||||||
relQuality = relQuality > (1.00 / 100.0) ? relQuality : 0.0;
|
relQuality = relQuality > (1.00f / 100.0f) ? relQuality : 0.0f;
|
||||||
relQuality = relQuality < (99.0 / 100.0) ? relQuality : 1.0;
|
relQuality = relQuality < (99.0f / 100.0f) ? relQuality : 1.0f;
|
||||||
totalRelativeQuality += relQuality;
|
totalRelativeQuality += relQuality;
|
||||||
_paths[i].p->updateRelativeQuality(relQuality);
|
_paths[i].p->updateRelativeQuality(relQuality);
|
||||||
}
|
}
|
||||||
|
@ -479,8 +479,8 @@ char *Peer::interfaceListStr()
|
||||||
if (_paths[i].p && _paths[i].p->alive(now)) {
|
if (_paths[i].p && _paths[i].p->alive(now)) {
|
||||||
int ipv = _paths[i].p->address().isV4();
|
int ipv = _paths[i].p->address().isV4();
|
||||||
// If this is acting as an aggregate link, check allocations
|
// If this is acting as an aggregate link, check allocations
|
||||||
float targetAllocation = 1.0 / alivePathCount;
|
float targetAllocation = 1.0f / (float)alivePathCount;
|
||||||
float currentAllocation = 1.0;
|
float currentAllocation = 1.0f;
|
||||||
if (alivePathCount > 1) {
|
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) {
|
if (fabs(targetAllocation - currentAllocation) > ZT_PATH_IMBALANCE_THRESHOLD) {
|
||||||
|
|
|
@ -389,7 +389,7 @@ public:
|
||||||
_bindings[_bindingCount].udpSock = udps;
|
_bindings[_bindingCount].udpSock = udps;
|
||||||
_bindings[_bindingCount].tcpListenSock = tcps;
|
_bindings[_bindingCount].tcpListenSock = tcps;
|
||||||
_bindings[_bindingCount].address = ii->first;
|
_bindings[_bindingCount].address = ii->first;
|
||||||
phy.setIfName(udps, (char*)ii->second.c_str(), ii->second.length());
|
phy.setIfName(udps,(char*)ii->second.c_str(),(int)ii->second.length());
|
||||||
++_bindingCount;
|
++_bindingCount;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
<ClCompile Include="..\..\controller\DB.cpp" />
|
<ClCompile Include="..\..\controller\DB.cpp" />
|
||||||
<ClCompile Include="..\..\controller\EmbeddedNetworkController.cpp" />
|
<ClCompile Include="..\..\controller\EmbeddedNetworkController.cpp" />
|
||||||
<ClCompile Include="..\..\controller\FileDB.cpp" />
|
<ClCompile Include="..\..\controller\FileDB.cpp" />
|
||||||
|
<ClCompile Include="..\..\controller\PostgreSQL.cpp" />
|
||||||
|
<ClCompile Include="..\..\controller\RabbitMQ.cpp" />
|
||||||
<ClCompile Include="..\..\ext\http-parser\http_parser.c" />
|
<ClCompile Include="..\..\ext\http-parser\http_parser.c" />
|
||||||
<ClCompile Include="..\..\ext\libnatpmp\getgateway.c" />
|
<ClCompile Include="..\..\ext\libnatpmp\getgateway.c" />
|
||||||
<ClCompile Include="..\..\ext\libnatpmp\natpmp.c" />
|
<ClCompile Include="..\..\ext\libnatpmp\natpmp.c" />
|
||||||
|
@ -114,6 +116,8 @@
|
||||||
<ClInclude Include="..\..\controller\DB.hpp" />
|
<ClInclude Include="..\..\controller\DB.hpp" />
|
||||||
<ClInclude Include="..\..\controller\EmbeddedNetworkController.hpp" />
|
<ClInclude Include="..\..\controller\EmbeddedNetworkController.hpp" />
|
||||||
<ClInclude Include="..\..\controller\FileDB.hpp" />
|
<ClInclude Include="..\..\controller\FileDB.hpp" />
|
||||||
|
<ClInclude Include="..\..\controller\PostgreSQL.hpp" />
|
||||||
|
<ClInclude Include="..\..\controller\RabbitMQ.hpp" />
|
||||||
<ClInclude Include="..\..\ext\http-parser\http_parser.h" />
|
<ClInclude Include="..\..\ext\http-parser\http_parser.h" />
|
||||||
<ClInclude Include="..\..\ext\json\json.hpp" />
|
<ClInclude Include="..\..\ext\json\json.hpp" />
|
||||||
<ClInclude Include="..\..\ext\libnatpmp\getgateway.h" />
|
<ClInclude Include="..\..\ext\libnatpmp\getgateway.h" />
|
||||||
|
|
|
@ -258,6 +258,12 @@
|
||||||
<ClCompile Include="..\..\controller\FileDB.cpp">
|
<ClCompile Include="..\..\controller\FileDB.cpp">
|
||||||
<Filter>Source Files\controller</Filter>
|
<Filter>Source Files\controller</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\controller\PostgreSQL.cpp">
|
||||||
|
<Filter>Source Files\controller</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\controller\RabbitMQ.cpp">
|
||||||
|
<Filter>Source Files\controller</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="resource.h">
|
<ClInclude Include="resource.h">
|
||||||
|
@ -494,6 +500,12 @@
|
||||||
<ClInclude Include="..\..\node\Membership.hpp">
|
<ClInclude Include="..\..\node\Membership.hpp">
|
||||||
<Filter>Header Files\node</Filter>
|
<Filter>Header Files\node</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\controller\PostgreSQL.hpp">
|
||||||
|
<Filter>Header Files\controller</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\controller\RabbitMQ.hpp">
|
||||||
|
<Filter>Header Files\controller</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="ZeroTierOne.rc">
|
<ResourceCompile Include="ZeroTierOne.rc">
|
||||||
|
|
Loading…
Add table
Reference in a new issue