diff --git a/node/Bond.cpp b/node/Bond.cpp
index 34964269..a570b724 100644
--- a/node/Bond.cpp
+++ b/node/Bond.cpp
@@ -1159,16 +1159,17 @@ void Bond::estimatePathQuality(int64_t now)
// Compute/Smooth average of real-world observations
_paths[i].latencyMean = _paths[i].latencySamples.mean();
_paths[i].latencyVariance = _paths[i].latencySamples.stddev();
- //_paths[i].packetErrorRatio = 1.0 - (_paths[i].packetValiditySamples.count() ? _paths[i].packetValiditySamples.mean() : 1.0);
- if (userHasSpecifiedLinkSpeeds()) {
- // Use user-reported metrics
- SharedPtr link = RR->bc->getLinkBySocket(_policyAlias, _paths[i].p->localSocket());
- if (link) {
- _paths[i].throughputMean = link->speed();
- _paths[i].throughputVariance = 0;
- }
- }
+ // Write values to external path object so that it can be propagated to the user
+ _paths[i].p->_latencyMean = _paths[i].latencyMean;
+ _paths[i].p->_latencyVariance = _paths[i].latencyVariance;
+ _paths[i].p->_packetLossRatio = _paths[i].packetLossRatio;
+ _paths[i].p->_packetErrorRatio = _paths[i].packetErrorRatio;
+ _paths[i].p->_bonded = _paths[i].bonded;
+ _paths[i].p->_givenLinkSpeed = 0;//_paths[i].givenLinkSpeed;
+ _paths[i].p->_allocation = _paths[i].allocation;
+
+ //_paths[i].packetErrorRatio = 1.0 - (_paths[i].packetValiditySamples.count() ? _paths[i].packetValiditySamples.mean() : 1.0);
// Drain unacknowledged QoS records
int qosRecordTimeout = (_qosSendInterval * 3);
@@ -1184,7 +1185,7 @@ void Bond::estimatePathQuality(int64_t now)
}
}
if (numDroppedQosOutRecords) {
- log("Dropped %d QOS out-records", numDroppedQosOutRecords);
+ debug("Dropped %d QOS out-records", numDroppedQosOutRecords);
}
/*
diff --git a/node/Bond.hpp b/node/Bond.hpp
index 3f2624f2..b36c7f34 100644
--- a/node/Bond.hpp
+++ b/node/Bond.hpp
@@ -1159,8 +1159,9 @@ class Bond {
std::vector > pp;
Mutex::Lock _l(_paths_m);
for (unsigned int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) {
- if (! _paths[i].p)
- break;
+ if (! _paths[i].p) {
+ continue;
+ }
pp.push_back(_paths[i].p);
}
return pp;
@@ -1258,9 +1259,6 @@ class Bond {
, latencyVariance(0)
, packetLossRatio(0)
, packetErrorRatio(0)
- , throughputMean(0)
- , throughputMax(0)
- , throughputVariance(0)
, allocation(0)
, byteLoad(0)
, relativeByteLoad(0)
@@ -1394,9 +1392,6 @@ class Bond {
float latencyVariance; // Packet delay variance (computed from a sliding window.)
float packetLossRatio; // The ratio of lost packets to received packets.
float packetErrorRatio; // The ratio of packets that failed their MAC/CRC checks to those that did not.
- uint64_t throughputMean; // The estimated mean throughput of this path.
- uint64_t throughputMax; // The maximum observed throughput of this path.
- float throughputVariance; // The variance in the estimated throughput of this path.
uint8_t allocation; // The relative quality of this path to all others in the bond, [0-255].
uint64_t byteLoad; // How much load this path is under.
uint8_t relativeByteLoad; // How much load this path is under (relative to other paths in the bond.)
diff --git a/node/Path.hpp b/node/Path.hpp
index 3471e2d6..7a39fe0d 100644
--- a/node/Path.hpp
+++ b/node/Path.hpp
@@ -280,6 +280,41 @@ public:
return false;
}
+ /**
+ * @return Mean latency as reported by the bonding layer
+ */
+ inline unsigned int latencyMean() const { return _latencyMean; }
+
+ /**
+ * @return Latency variance as reported by the bonding layer
+ */
+ inline unsigned int latencyVariance() const { return _latencyVariance; }
+
+ /**
+ * @return Packet Loss Ratio as reported by the bonding layer
+ */
+ inline unsigned int packetLossRatio() const { return _packetLossRatio; }
+
+ /**
+ * @return Packet Error Ratio as reported by the bonding layer
+ */
+ inline unsigned int packetErrorRatio() const { return _packetErrorRatio; }
+
+ /**
+ * @return Whether this path is bonded as reported by the bonding layer
+ */
+ inline unsigned int bonded() const { return _bonded; }
+
+ /**
+ * @return Given link speed as reported by the bonding layer
+ */
+ inline unsigned int givenLinkSpeed() const { return _givenLinkSpeed; }
+
+ /**
+ * @return Traffic allocation as reported by the bonding layer
+ */
+ inline unsigned int allocation() const { return _allocation; }
+
void *_bondingMetricPtr;
private:
@@ -288,9 +323,18 @@ private:
volatile int64_t _lastIn;
volatile int64_t _lastTrustEstablishedPacketReceived;
+ volatile float _latencyMean;
+ volatile float _latencyVariance;
+ volatile float _packetLossRatio;
+ volatile float _packetErrorRatio;
+ volatile bool _bonded;
+ volatile int64_t _givenLinkSpeed;
+ volatile int8_t _allocation;
+
int64_t _lastEchoRequestReceived;
int64_t _localSocket;
+
volatile unsigned int _latency;
InetAddress _addr;
InetAddress::IpScope _ipScope; // memoize this since it's a computed value checked often
diff --git a/one.cpp b/one.cpp
index 82816389..0a30a47c 100644
--- a/one.cpp
+++ b/one.cpp
@@ -613,9 +613,7 @@ static int cli(int argc,char **argv)
int numTotalLinks = OSUtils::jsonInt(j["numTotalLinks"],0);
printf("Peer : %s\n", arg1.c_str());
printf("Bond : %s\n", OSUtils::jsonString(j["bondingPolicy"],"-").c_str());
- //if (bondingPolicy == ZT_BOND_POLICY_ACTIVE_BACKUP) {
printf("Link Select Method : %d\n", (int)OSUtils::jsonInt(j["linkSelectMethod"],0));
- //}
printf("Links : %d/%d\n", numAliveLinks, numTotalLinks);
printf("Failover Interval : %d (ms)\n", (int)OSUtils::jsonInt(j["failoverInterval"],0));
printf("Up Delay : %d (ms)\n", (int)OSUtils::jsonInt(j["upDelay"],0));
@@ -623,30 +621,32 @@ static int cli(int argc,char **argv)
printf("Packets Per Link : %d (ms)\n", (int)OSUtils::jsonInt(j["packetsPerLink"],0));
nlohmann::json &p = j["links"];
if (p.is_array()) {
- printf("\n Interface Name\t\t\t\t\t Path\t Alive\n");
+ printf("\n interface\t\t\t\t\t path\n");
for(int i=0; i<80; i++) { printf("-"); }
printf("\n");
for (int i=0; i &bond)
nlohmann::json j;
j["ifname"] = bond->getLink(paths[i])->ifname();
j["path"] = pathStr;
- /*
- j["alive"] = paths[i]->alive(now,true);
- j["bonded"] = paths[i]->bonded();
j["latencyMean"] = paths[i]->latencyMean();
j["latencyVariance"] = paths[i]->latencyVariance();
j["packetLossRatio"] = paths[i]->packetLossRatio();
j["packetErrorRatio"] = paths[i]->packetErrorRatio();
- j["givenLinkSpeed"] = 1000;
+ j["alive"] = paths[i]->alive(now);
+ j["bonded"] = paths[i]->bonded();
+ j["givenLinkSpeed"] = paths[i]->givenLinkSpeed();
j["allocation"] = paths[i]->allocation();
- */
pa.push_back(j);
}
pj["links"] = pa;