@@ -373,6 +373,7 @@ SharedPtr<Path> Bond::getAppropriatePath(int64_t now, int32_t flowId)
373
373
*/
374
374
if (_policy == ZT_BOND_POLICY_ACTIVE_BACKUP) {
375
375
if (_abPathIdx != ZT_MAX_PEER_NETWORK_PATHS && _paths[_abPathIdx].p ) {
376
+ // fprintf(stderr, "trying to send via (_abPathIdx=%d) %s\n", _abPathIdx, pathToStr(_paths[_abPathIdx].p).c_str());
376
377
return _paths[_abPathIdx].p ;
377
378
}
378
379
}
@@ -1032,6 +1033,13 @@ void Bond::curateBond(int64_t now, bool rebuildBond)
1032
1033
bool satisfiedUpDelay = (now - _paths[i].lastAliveToggle ) >= _upDelay;
1033
1034
// How long since the last QoS was received (Must be less than ZT_PEER_PATH_EXPIRATION since the remote peer's _qosSendInterval isn't known)
1034
1035
bool acceptableQoSAge = (_paths[i].lastQoSReceived == 0 && inTrial) || ((now - _paths[i].lastQoSReceived ) < ZT_PEER_EXPIRED_PATH_TRIAL_PERIOD);
1036
+
1037
+ // Allow active-backup to operate without the receipt of QoS records
1038
+ // This may be expanded to the other modes as an option
1039
+ if (_policy == ZT_BOND_POLICY_ACTIVE_BACKUP) {
1040
+ acceptableQoSAge = true ;
1041
+ }
1042
+
1035
1043
currEligibility = _paths[i].allowed () && ((acceptableAge && satisfiedUpDelay && acceptableQoSAge) || inTrial);
1036
1044
1037
1045
if (currEligibility) {
@@ -1043,12 +1051,11 @@ void Bond::curateBond(int64_t now, bool rebuildBond)
1043
1051
*/
1044
1052
if (currEligibility != _paths[i].eligible ) {
1045
1053
if (currEligibility == 0 ) {
1046
- log (" link %s is no longer eligible" , pathToStr (_paths[i].p ).c_str ());
1054
+ log (" link %s is no longer eligible (reason: allowed=%d, age=%d, ud=%d, qos=%d, trial=%d) " , pathToStr (_paths[i].p ).c_str (), _paths[i]. allowed (), acceptableAge, satisfiedUpDelay, acceptableQoSAge, inTrial );
1047
1055
}
1048
1056
if (currEligibility == 1 ) {
1049
1057
log (" link %s is eligible" , pathToStr (_paths[i].p ).c_str ());
1050
1058
}
1051
- debug (" \t [%d] allowed=%d, age=%d, qa=%d, ud=%d, trial=%d" , i, _paths[i].allowed (), acceptableAge, acceptableQoSAge, satisfiedUpDelay, inTrial);
1052
1059
dumpPathStatus (now, i);
1053
1060
if (currEligibility) {
1054
1061
rebuildBond = true ;
@@ -1496,7 +1503,8 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1496
1503
{
1497
1504
int prevActiveBackupPathIdx = _abPathIdx;
1498
1505
int nonPreferredPathIdx = ZT_MAX_PEER_NETWORK_PATHS;
1499
- bool bFoundPrimaryLink = false ;
1506
+ bool foundPathOnPrimaryLink = false ;
1507
+ bool foundPreferredPath = false ;
1500
1508
1501
1509
if (_abPathIdx != ZT_MAX_PEER_NETWORK_PATHS && ! _paths[_abPathIdx].p ) {
1502
1510
_abPathIdx = ZT_MAX_PEER_NETWORK_PATHS;
@@ -1559,24 +1567,25 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1559
1567
if (! _paths[i].preferred ()) {
1560
1568
// Found path on primary link, take note in case we don't find a preferred path
1561
1569
nonPreferredPathIdx = i;
1562
- bFoundPrimaryLink = true ;
1570
+ foundPathOnPrimaryLink = true ;
1563
1571
}
1564
1572
if (_paths[i].preferred ()) {
1565
1573
_abPathIdx = i;
1566
- bFoundPrimaryLink = true ;
1574
+ foundPathOnPrimaryLink = true ;
1567
1575
if (_paths[_abPathIdx].p ) {
1568
1576
SharedPtr<Link> abLink = RR->bc ->getLinkBySocket (_policyAlias, _paths[_abPathIdx].p ->localSocket ());
1569
1577
if (abLink) {
1570
- log (" found preferred primary link %s" , pathToStr (_paths[_abPathIdx].p ).c_str ());
1578
+ log (" found preferred primary link (_abPathIdx=%d), %s" , _abPathIdx, pathToStr (_paths[_abPathIdx].p ).c_str ());
1579
+ foundPreferredPath = true ;
1571
1580
}
1572
1581
break ; // Found preferred path on primary link
1573
1582
}
1574
1583
}
1575
1584
}
1576
1585
}
1577
1586
}
1578
- if (bFoundPrimaryLink && (nonPreferredPathIdx != ZT_MAX_PEER_NETWORK_PATHS)) {
1579
- log (" found non-preferred primary link" );
1587
+ if (!foundPreferredPath && foundPathOnPrimaryLink && (nonPreferredPathIdx != ZT_MAX_PEER_NETWORK_PATHS)) {
1588
+ log (" found non-preferred primary link (_abPathIdx=%d) " , _abPathIdx );
1580
1589
_abPathIdx = nonPreferredPathIdx;
1581
1590
}
1582
1591
}
@@ -1614,10 +1623,10 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1614
1623
}
1615
1624
if (_paths[(*it)].p && ! _paths[(*it)].eligible ) {
1616
1625
SharedPtr<Link> link = RR->bc ->getLinkBySocket (_policyAlias, _paths[(*it)].p ->localSocket ());
1617
- it = _abFailoverQueue.erase (it);
1618
1626
if (link ) {
1619
- log (" link %s is ineligible, removing from failover queue (%zu links remain in queue)" , pathToStr (_paths[_abPathIdx ].p ).c_str (), _abFailoverQueue.size ());
1627
+ log (" link %s is ineligible, removing from failover queue (%zu links remain in queue)" , pathToStr (_paths[(*it) ].p ).c_str (), _abFailoverQueue.size ());
1620
1628
}
1629
+ it = _abFailoverQueue.erase (it);
1621
1630
continue ;
1622
1631
}
1623
1632
else {
@@ -1684,7 +1693,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1684
1693
}
1685
1694
}
1686
1695
if (! bFoundPathInQueue) {
1687
- _abFailoverQueue.push_front (i);
1696
+ _abFailoverQueue.push_back (i);
1688
1697
log (" add link %s to failover queue (%zu links in queue)" , pathToStr (_paths[i].p ).c_str (), _abFailoverQueue.size ());
1689
1698
addPathToBond (i, 0 );
1690
1699
}
@@ -1734,13 +1743,14 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1734
1743
}
1735
1744
}
1736
1745
if (! bFoundPathInQueue) {
1737
- _abFailoverQueue.push_front (i);
1746
+ _abFailoverQueue.push_back (i);
1738
1747
log (" add link %s to failover queue (%zu links in queue)" , pathToStr (_paths[i].p ).c_str (), _abFailoverQueue.size ());
1739
1748
addPathToBond (i, 0 );
1740
1749
}
1741
1750
}
1742
1751
}
1743
1752
}
1753
+ /*
1744
1754
// Sort queue based on performance
1745
1755
if (! _abFailoverQueue.empty()) {
1746
1756
for (int i = 0; i < _abFailoverQueue.size(); i++) {
@@ -1752,7 +1762,7 @@ void Bond::processActiveBackupTasks(void* tPtr, int64_t now)
1752
1762
}
1753
1763
_abFailoverQueue[hole_position] = value_to_insert;
1754
1764
}
1755
- }
1765
+ }*/
1756
1766
1757
1767
/* *
1758
1768
* Short-circuit if we have no queued paths
@@ -1902,7 +1912,7 @@ void Bond::setBondParameters(int policy, SharedPtr<Bond> templateBond, bool useT
1902
1912
* Policy defaults
1903
1913
*/
1904
1914
_abPathIdx = ZT_MAX_PEER_NETWORK_PATHS;
1905
- _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_OPTIMIZE ;
1915
+ _abLinkSelectMethod = ZT_BOND_RESELECTION_POLICY_ALWAYS ;
1906
1916
_rrPacketsSentOnCurrLink = 0 ;
1907
1917
_rrIdx = 0 ;
1908
1918
_packetsPerLink = 64 ;
@@ -2021,7 +2031,8 @@ void Bond::dumpInfo(int64_t now, bool force)
2021
2031
_lastSummaryDump = now;
2022
2032
float overhead = (_overheadBytes / (timeSinceLastDump / 1000 .0f ) / 1000 .0f );
2023
2033
_overheadBytes = 0 ;
2024
- log (" bond: bp=%d, fi=%" PRIu64 " , mi=%d, ud=%d, dd=%d, flows=%zu, leaf=%d, overhead=%f KB/s, links=(%d/%d)" ,
2034
+ log (" bond: ready=%d, bp=%d, fi=%" PRIu64 " , mi=%d, ud=%d, dd=%d, flows=%zu, leaf=%d, overhead=%f KB/s, links=(%d/%d)" ,
2035
+ isReady (),
2025
2036
_policy,
2026
2037
_failoverInterval,
2027
2038
_monitorInterval,
0 commit comments