mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-29 23:53:58 +00:00
Remove vestigial constructor, fix typos, clean up code
This commit is contained in:
parent
7ed960297b
commit
7266550c22
@ -29,7 +29,8 @@ Bond::Bond(const RuntimeEnvironment *renv, int policy, const SharedPtr<Peer>& pe
|
||||
_policyAlias = BondController::getPolicyStrByCode(policy);
|
||||
}
|
||||
|
||||
Bond::Bond(std::string& basePolicy, std::string& policyAlias, const SharedPtr<Peer>& peer) :
|
||||
Bond::Bond(const RuntimeEnvironment *renv, std::string& basePolicy, std::string& policyAlias, const SharedPtr<Peer>& peer) :
|
||||
RR(renv),
|
||||
_policyAlias(policyAlias),
|
||||
_peer(peer)
|
||||
{
|
||||
@ -1518,20 +1519,23 @@ void Bond::setReasonableDefaults(int policy)
|
||||
_upDelay = 0;
|
||||
_allowFlowHashing=false;
|
||||
_bondMonitorInterval=0;
|
||||
_allowPathNegotiation=false;
|
||||
_shouldCollectPathStatistics=false;
|
||||
_lastPathNegotiationReceived=0;
|
||||
_lastBackgroundTaskCheck=0;
|
||||
|
||||
// Path negotiation
|
||||
_allowPathNegotiation=false;
|
||||
_lastPathNegotiationReceived=0;
|
||||
_lastPathNegotiationCheck=0;
|
||||
_pathNegotiationCutoffCount=0;
|
||||
_localUtility=0;
|
||||
|
||||
_lastFlowStatReset=0;
|
||||
_lastFlowExpirationCheck=0;
|
||||
_localUtility=0;
|
||||
|
||||
_numBondedPaths=0;
|
||||
_rrPacketsSentOnCurrSlave=0;
|
||||
_rrIdx=0;
|
||||
_lastPathNegotiationReceived=0;
|
||||
_pathNegotiationCutoffCount=0;
|
||||
|
||||
_lastFlowRebalance=0;
|
||||
_totalBondUnderload = 0;
|
||||
|
||||
@ -1543,12 +1547,6 @@ void Bond::setReasonableDefaults(int policy)
|
||||
|
||||
_lastFrame=0;
|
||||
|
||||
// TODO: Remove
|
||||
_header=false;
|
||||
_lastLogTS = 0;
|
||||
_lastPrintTS = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -1582,7 +1580,7 @@ void Bond::setReasonableDefaults(int policy)
|
||||
case ZT_BONDING_POLICY_BALANCE_RR:
|
||||
_failoverInterval = 5000;
|
||||
_allowFlowHashing = false;
|
||||
_packetsPerSlave = 512;
|
||||
_packetsPerSlave = 1024;
|
||||
_slaveMonitorStrategy = ZT_MULTIPATH_SLAVE_MONITOR_STRATEGY_DYNAMIC;
|
||||
_qualityWeights[ZT_QOS_LAT_IDX] = 0.4f;
|
||||
_qualityWeights[ZT_QOS_LTM_IDX] = 0.0f;
|
||||
@ -1653,11 +1651,23 @@ void Bond::setReasonableDefaults(int policy)
|
||||
_qosSendInterval = _bondMonitorInterval * 4;
|
||||
_qosCutoffCount = 0;
|
||||
_lastQoSRateCheck = 0;
|
||||
_lastQualityEstimation=0;
|
||||
throughputMeasurementInterval = _ackSendInterval * 2;
|
||||
BondController::setMinReqPathMonitorInterval(_bondMonitorInterval);
|
||||
|
||||
_defaultPathRefractoryPeriod = 8000;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TODO: Remove
|
||||
_header=false;
|
||||
_lastLogTS = 0;
|
||||
_lastPrintTS = 0;
|
||||
|
||||
|
||||
|
||||
fprintf(stderr, "TIMERS: strat=%d, fi= %d, bmi= %d, qos= %d, ack= %d, estimateInt= %d, refractory= %d, ud= %d, dd= %d\n",
|
||||
_slaveMonitorStrategy,
|
||||
_failoverInterval,
|
||||
@ -1669,7 +1679,7 @@ void Bond::setReasonableDefaults(int policy)
|
||||
_upDelay,
|
||||
_downDelay);
|
||||
|
||||
_lastQualityEstimation=0;
|
||||
|
||||
}
|
||||
|
||||
void Bond::setUserQualityWeights(float weights[], int len)
|
||||
|
@ -54,13 +54,6 @@ public:
|
||||
|
||||
SharedPtr<Slave> getSlave(const SharedPtr<Path>& path);
|
||||
|
||||
/**
|
||||
* Constructor. For use only in first initialization in Node
|
||||
*
|
||||
* @param renv Runtime environment
|
||||
*/
|
||||
Bond(const RuntimeEnvironment *renv);
|
||||
|
||||
/**
|
||||
* Constructor. Creates a bond based off of ZT defaults
|
||||
*
|
||||
@ -77,7 +70,7 @@ public:
|
||||
* @param policyAlias
|
||||
* @param peer
|
||||
*/
|
||||
Bond(std::string& basePolicy, std::string& policyAlias, const SharedPtr<Peer>& peer);
|
||||
Bond(const RuntimeEnvironment *renv, std::string& basePolicy, std::string& policyAlias, const SharedPtr<Peer>& peer);
|
||||
|
||||
/**
|
||||
* Constructor. Creates a bond based off of a user-defined bond template
|
||||
@ -89,8 +82,7 @@ public:
|
||||
Bond(const RuntimeEnvironment *renv, const Bond &original, const SharedPtr<Peer>& peer);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @return The human-readable name of the bonding policy
|
||||
*/
|
||||
std::string policyAlias() { return _policyAlias; }
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
BondController(const RuntimeEnvironment *renv);
|
||||
|
||||
/**
|
||||
* @return The minimum interval required to poll the active bonds to fulfill all active monitoring timing requirements.
|
||||
* @return Whether this slave is permitted to become a member of a bond.
|
||||
*/
|
||||
bool slaveAllowed(std::string &policyAlias, SharedPtr<Slave> slave);
|
||||
|
||||
@ -46,7 +46,7 @@ public:
|
||||
int minReqPathMonitorInterval() { return _minReqPathMonitorInterval; }
|
||||
|
||||
/**
|
||||
* @return The minimum interval required to poll the active bonds to fulfill all active monitoring timing requirements.
|
||||
* @param minReqPathMonitorInterval The minimum interval required to poll the active bonds to fulfill all active monitoring timing requirements.
|
||||
*/
|
||||
static void setMinReqPathMonitorInterval(int minReqPathMonitorInterval) { _minReqPathMonitorInterval = minReqPathMonitorInterval; }
|
||||
|
||||
|
@ -127,8 +127,7 @@ public:
|
||||
_packetsReceivedSinceLastQoS(0),
|
||||
_bytesAckedSinceLastThroughputEstimation(0),
|
||||
_packetsIn(0),
|
||||
_packetsOut(0),
|
||||
_prevEligibility(false)
|
||||
_packetsOut(0)
|
||||
{}
|
||||
|
||||
Path(const int64_t localSocket,const InetAddress &addr) :
|
||||
@ -177,8 +176,7 @@ public:
|
||||
_packetsReceivedSinceLastQoS(0),
|
||||
_bytesAckedSinceLastThroughputEstimation(0),
|
||||
_packetsIn(0),
|
||||
_packetsOut(0),
|
||||
_prevEligibility(false)
|
||||
_packetsOut(0)
|
||||
{}
|
||||
|
||||
/**
|
||||
@ -187,10 +185,10 @@ public:
|
||||
* @param t Time of receive
|
||||
*/
|
||||
inline void received(const uint64_t t) {
|
||||
_lastIn = t;
|
||||
if (!_prevEligibility) {
|
||||
if (!alive(t,_bonded)) {
|
||||
_lastAliveToggle = _lastIn;
|
||||
}
|
||||
_lastIn = t;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -506,7 +504,7 @@ private:
|
||||
uint64_t _lastQoSMeasurement;
|
||||
|
||||
/**
|
||||
* Last time that a the path's throughput was estimated.
|
||||
* Last time that the path's throughput was estimated.
|
||||
*/
|
||||
uint64_t _lastThroughputEstimation;
|
||||
|
||||
@ -531,7 +529,7 @@ private:
|
||||
uint64_t _lastTrialBegin;
|
||||
|
||||
/**
|
||||
* Amount of time that this path is prevented from becoming a member of a bond.
|
||||
* Amount of time that this path will be prevented from becoming a member of a bond.
|
||||
*/
|
||||
uint32_t _refractoryPeriod;
|
||||
|
||||
@ -576,7 +574,7 @@ private:
|
||||
bool _bonded;
|
||||
|
||||
/**
|
||||
* Whether this path was intentionally _negotiated by either peer.
|
||||
* Whether this path was intentionally negotiated by either peer.
|
||||
*/
|
||||
bool _negotiated;
|
||||
|
||||
@ -684,10 +682,6 @@ private:
|
||||
*/
|
||||
int _packetsIn;
|
||||
int _packetsOut;
|
||||
|
||||
// TODO: Remove
|
||||
|
||||
bool _prevEligibility;
|
||||
};
|
||||
|
||||
} // namespace ZeroTier
|
||||
|
@ -1596,7 +1596,7 @@ public:
|
||||
continue;
|
||||
}
|
||||
// New bond, used as a copy template for new instances
|
||||
SharedPtr<Bond> newTemplateBond = new Bond(basePolicyStr, customPolicyStr, SharedPtr<Peer>());
|
||||
SharedPtr<Bond> newTemplateBond = new Bond(NULL, basePolicyStr, customPolicyStr, SharedPtr<Peer>());
|
||||
// Acceptable ranges
|
||||
newTemplateBond->setMaxAcceptableLatency(OSUtils::jsonInt(customPolicy["maxAcceptableLatency"],-1));
|
||||
newTemplateBond->setMaxAcceptableMeanLatency(OSUtils::jsonInt(customPolicy["maxAcceptableMeanLatency"],-1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user