Przeglądaj źródła

Added debug traces

Joseph Henry 7 lat temu
rodzic
commit
20a25a6a45
2 zmienionych plików z 14 dodań i 0 usunięć
  1. 10 0
      node/Path.hpp
  2. 4 0
      node/Peer.cpp

+ 10 - 0
node/Path.hpp

@@ -44,6 +44,8 @@
 
 #include "../osdep/Phy.hpp"
 
+#include "../include/ZeroTierDebug.h"
+
 /**
  * Maximum return value of preferenceRank()
  */
@@ -314,6 +316,7 @@ public:
 	 */
 	inline void recordOutgoingPacket(int64_t now, int64_t packetId, uint16_t payloadLength, Packet::Verb verb)
 	{
+		DEBUG_INFO("");
 		Mutex::Lock _l(_statistics_m);
 		if (verb != Packet::VERB_ACK && verb != Packet::VERB_QOS_MEASUREMENT) {
 			if ((packetId & (ZT_PATH_QOS_ACK_PROTOCOL_DIVISOR - 1)) == 0) {
@@ -337,6 +340,7 @@ public:
 	 */
 	inline void recordIncomingPacket(int64_t now, int64_t packetId, uint16_t payloadLength, Packet::Verb verb)
 	{
+		DEBUG_INFO("");
 		Mutex::Lock _l(_statistics_m);
 		if (verb != Packet::VERB_ACK && verb != Packet::VERB_QOS_MEASUREMENT) {
 			if ((packetId & (ZT_PATH_QOS_ACK_PROTOCOL_DIVISOR - 1)) == 0) {
@@ -357,6 +361,7 @@ public:
 	 */
 	inline void receivedAck(int64_t now, int32_t ackedBytes)
 	{
+		DEBUG_INFO("");
 		_expectingAckAsOf = 0;
 		_unackedBytes = (ackedBytes > _unackedBytes) ? 0 : _unackedBytes - ackedBytes;
 		int64_t timeSinceThroughputEstimate = (now - _lastThroughputEstimation);
@@ -401,6 +406,7 @@ public:
 	 */
 	inline void sentAck(int64_t now)
 	{
+		DEBUG_INFO("");
 		Mutex::Lock _l(_statistics_m);
 		_inACKRecords.clear();
 		_packetsReceivedSinceLastAck = 0;
@@ -418,6 +424,7 @@ public:
 	 */
 	inline void receivedQoS(int64_t now, int count, uint64_t *rx_id, uint16_t *rx_ts)
 	{
+		DEBUG_INFO("");
 		Mutex::Lock _l(_statistics_m);
 		// Look up egress times and compute latency values for each record
 		std::map<uint64_t,uint64_t>::iterator it;
@@ -442,6 +449,7 @@ public:
 	 */
 	inline int32_t generateQoSPacket(int64_t now, char *qosBuffer)
 	{
+		DEBUG_INFO("");
 		Mutex::Lock _l(_statistics_m);
 		int32_t len = 0;
 		std::map<uint64_t,uint64_t>::iterator it = _inQoSRecords.begin();
@@ -466,6 +474,7 @@ public:
 	 * @param Current time
 	 */
 	inline void sentQoS(int64_t now) {
+		DEBUG_INFO("");
 		_packetsReceivedSinceLastQoS = 0;
 		_lastQoSMeasurement = now;
 	}
@@ -584,6 +593,7 @@ public:
 	 */
 	inline void processBackgroundPathMeasurements(int64_t now) {
 		if (now - _lastPathQualityComputeTime > ZT_PATH_QUALITY_COMPUTE_INTERVAL) {
+			DEBUG_INFO("");
 			Mutex::Lock _l(_statistics_m);
 			_lastPathQualityComputeTime = now;
 			address().toString(_addrString);

+ 4 - 0
node/Peer.cpp

@@ -37,6 +37,8 @@
 #include "RingBuffer.hpp"
 #include "Utils.hpp"
 
+#include "../include/ZeroTierDebug.h"
+
 namespace ZeroTier {
 
 Peer::Peer(const RuntimeEnvironment *renv,const Identity &myIdentity,const Identity &peerIdentity) :
@@ -681,6 +683,8 @@ inline void Peer::processBackgroundPeerTasks(int64_t now)
 		_localMultipathSupported = ((RR->node->getMultipathMode() != ZT_MULTIPATH_NONE) && (ZT_PROTO_VERSION > 9));
 		_remoteMultipathSupported = _vProto > 9;
 		// If both peers support multipath and more than one path exist, we can use multipath logic
+		DEBUG_INFO("from=%llx, _localMultipathSupported=%d, _remoteMultipathSupported=%d, (_uniqueAlivePathCount > 1)=%d", 
+			this->_id.address().toInt(), _localMultipathSupported, _remoteMultipathSupported, (_uniqueAlivePathCount > 1));
 		_canUseMultipath = _localMultipathSupported && _remoteMultipathSupported && (_uniqueAlivePathCount > 1);
 	}
 }