瀏覽代碼

Add minor trace output formatting changes. Change ZT_MULTIPATH_BOND_STATUS_INTERVAL from 30000 to 60000

Joseph Henry 4 年之前
父節點
當前提交
f3c9ab8a7e
共有 2 個文件被更改,包括 7 次插入6 次删除
  1. 6 5
      node/Bond.cpp
  2. 1 1
      node/Constants.hpp

+ 6 - 5
node/Bond.cpp

@@ -362,7 +362,8 @@ bool Bond::assignFlowToBondedPath(SharedPtr<Flow> &flow, int64_t now)
 	if (_bondingPolicy == ZT_BONDING_POLICY_BALANCE_XOR) {
 		idx = abs((int)(flow->id() % (_numBondedPaths)));
 		SharedPtr<Link> link = RR->bc->getLinkBySocket(_policyAlias, _paths[_bondedIdx[idx]]->localSocket());
-		sprintf(traceMsg, "%s (balance-xor) Assigned outgoing flow %x to peer %llx to link %s/%s, %lu active flow(s)\n",
+		_paths[_bondedIdx[idx]]->address().toString(curPathStr);
+		sprintf(traceMsg, "%s (balance-xor) Assigned outgoing flow %x to peer %llx to link %s/%s, %lu active flow(s)",
 			OSUtils::humanReadableTimestamp().c_str(), flow->id(), _peer->_id.address().toInt(), link->ifname().c_str(), curPathStr, _flows.size());
 		RR->t->bondStateMessage(NULL, traceMsg);
 		flow->assignPath(_paths[_bondedIdx[idx]],now);
@@ -417,7 +418,7 @@ bool Bond::assignFlowToBondedPath(SharedPtr<Flow> &flow, int64_t now)
 	}
 	flow->assignedPath()->address().toString(curPathStr);
 	SharedPtr<Link> link = RR->bc->getLinkBySocket(_policyAlias, flow->assignedPath()->localSocket());
-	sprintf(traceMsg, "%s (bond) Assigned outgoing flow %x to peer %llx to link %s/%s, %lu active flow(s)\n",
+	sprintf(traceMsg, "%s (bond) Assigned outgoing flow %x to peer %llx to link %s/%s, %lu active flow(s)",
 		OSUtils::humanReadableTimestamp().c_str(), flow->id(), _peer->_id.address().toInt(), link->ifname().c_str(), curPathStr, _flows.size());
 	RR->t->bondStateMessage(NULL, traceMsg);
 	return true;
@@ -452,7 +453,7 @@ SharedPtr<Flow> Bond::createFlow(const SharedPtr<Path> &path, int32_t flowId, un
 		path->address().toString(curPathStr);
 		path->_assignedFlowCount++;
 		SharedPtr<Link> link = RR->bc->getLinkBySocket(_policyAlias, flow->assignedPath()->localSocket());
-		sprintf(traceMsg, "%s (bond) Assigned incoming flow %x from peer %llx to link %s/%s, %lu active flow(s)\n",
+		sprintf(traceMsg, "%s (bond) Assigned incoming flow %x from peer %llx to link %s/%s, %lu active flow(s)",
 			OSUtils::humanReadableTimestamp().c_str(), flow->id(), _peer->_id.address().toInt(), link->ifname().c_str(), curPathStr, _flows.size());
 		RR->t->bondStateMessage(NULL, traceMsg);
 	}
@@ -475,7 +476,7 @@ void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now)
 	if (age) { // Remove by specific age
 		while (it != _flows.end()) {
 			if (it->second->age(now) > age) {
-				sprintf(traceMsg, "%s (bond) Forgetting flow %x between this node and peer %llx, %lu active flow(s)\n",
+				sprintf(traceMsg, "%s (bond) Forgetting flow %x between this node and peer %llx, %lu active flow(s)",
 					OSUtils::humanReadableTimestamp().c_str(), it->first, _peer->_id.address().toInt(), (_flows.size()-1));
 				RR->t->bondStateMessage(NULL, traceMsg);
 				it->second->assignedPath()->_assignedFlowCount--;
@@ -495,7 +496,7 @@ void Bond::forgetFlowsWhenNecessary(uint64_t age, bool oldest, int64_t now)
 			++it;
 		}
 		if (oldestFlow != _flows.end()) {
-			sprintf(traceMsg, "%s (bond) Forgetting oldest flow %x (of age %llu) between this node and peer %llx, %lu active flow(s)\n",
+			sprintf(traceMsg, "%s (bond) Forgetting oldest flow %x (of age %llu) between this node and peer %llx, %lu active flow(s)",
 				OSUtils::humanReadableTimestamp().c_str(), oldestFlow->first, oldestFlow->second->age(now), _peer->_id.address().toInt(), (_flows.size()-1));
 			RR->t->bondStateMessage(NULL, traceMsg);
 			oldestFlow->second->assignedPath()->_assignedFlowCount--;

+ 1 - 1
node/Constants.hpp

@@ -396,7 +396,7 @@
 /**
  * How often we emit a one-liner bond summary for each peer
  */
-#define ZT_MULTIPATH_BOND_STATUS_INTERVAL 30000
+#define ZT_MULTIPATH_BOND_STATUS_INTERVAL 60000
 
 /**
  * How long before we consider a path to be dead in the general sense. This is