Bunch more refactoring for an even more compact NetworkConfig representation, especially rules.
This commit is contained in:
parent
25a5275921
commit
b9dba97fdb
7 changed files with 524 additions and 248 deletions
|
@ -795,10 +795,11 @@ bool Switch::_trySend(const Packet &packet,bool encrypt,uint64_t nwid)
|
|||
if (!viaPath) {
|
||||
if (network) {
|
||||
unsigned int bestq = ~((unsigned int)0); // max unsigned int since quality is lower==better
|
||||
for(unsigned int ri=0;ri<network->config().staticDeviceCount();++ri) {
|
||||
const ZT_VirtualNetworkStaticDevice &r = network->config().staticDevice(ri);
|
||||
if ((r.address != peer->address().toInt())&&((r.flags & ZT_NETWORK_STATIC_DEVICE_IS_RELAY) != 0)) {
|
||||
SharedPtr<Peer> rp(RR->topology->getPeer(Address(r.address)));
|
||||
unsigned int ptr = 0;
|
||||
for(;;) {
|
||||
const Address raddr(network->config().nextRelay(ptr));
|
||||
if (raddr) {
|
||||
SharedPtr<Peer> rp(RR->topology->getPeer(raddr));
|
||||
if (rp) {
|
||||
const unsigned int q = rp->relayQuality(now);
|
||||
if (q < bestq) {
|
||||
|
@ -806,7 +807,7 @@ bool Switch::_trySend(const Packet &packet,bool encrypt,uint64_t nwid)
|
|||
rp.swap(relay);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue