浏览代码

Fix sanity checks overwriting custom policy parameters

grapexy 3 年之前
父节点
当前提交
b733bb8ead
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      node/Bond.cpp

+ 1 - 1
node/Bond.cpp

@@ -1721,7 +1721,7 @@ void Bond::setBondParameters(int policy, SharedPtr<Bond> templateBond, bool useT
 	// Sanity check for policy
 
 	_defaultPolicy = (_defaultPolicy <= ZT_BOND_POLICY_NONE || _defaultPolicy > ZT_BOND_POLICY_BALANCE_AWARE) ? ZT_BOND_POLICY_NONE : _defaultPolicy;
-	_policy = (policy <= ZT_BOND_POLICY_NONE || policy > ZT_BOND_POLICY_BALANCE_AWARE) ? ZT_BOND_POLICY_NONE : _defaultPolicy;
+	_policy = (policy <= ZT_BOND_POLICY_NONE || policy > ZT_BOND_POLICY_BALANCE_AWARE) ? _defaultPolicy : policy;
 
 	// Check if non-leaf to prevent spamming infrastructure
 	if (_peer) {