summaryrefslogtreecommitdiff
path: root/service/OneService.cpp
diff options
context:
space:
mode:
authorJoseph Henry <josephjah@gmail.com>2018-05-02 15:24:14 -0700
committerJoseph Henry <josephjah@gmail.com>2018-05-02 15:24:14 -0700
commit91c8e82c428cea9d9e0a6911fbd1820212871ad8 (patch)
tree29d6d512e1a2ae8621820af0e83a86c64e38f085 /service/OneService.cpp
parent1debe2292d85e2d377064f74246244ac607046bf (diff)
downloadinfinitytier-91c8e82c428cea9d9e0a6911fbd1820212871ad8.tar.gz
infinitytier-91c8e82c428cea9d9e0a6911fbd1820212871ad8.zip
Adjusted locking order of _paths_m for path pruning. Other minor multipath changes
Diffstat (limited to 'service/OneService.cpp')
-rw-r--r--service/OneService.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp
index 27930a52..563699e6 100644
--- a/service/OneService.cpp
+++ b/service/OneService.cpp
@@ -162,6 +162,7 @@ namespace ZeroTier { typedef BSDEthernetTap EthernetTap; }
// How often to check for local interface addresses
#define ZT_LOCAL_INTERFACE_CHECK_INTERVAL 60000
+#define ZT_MULTIPATH_LOCAL_INTERFACE_CHECK_INTERVAL 5000
// Maximum write buffer size for outgoing TCP connections (sanity limit)
#define ZT_TCP_MAX_WRITEQ_SIZE 33554432
@@ -856,6 +857,7 @@ public:
}
// Refresh bindings
+ // Do this more frequently when multipath bonding is enabled
int interfaceRefreshPeriod = _multipathMode ? ZT_MULTIPATH_BINDER_REFRESH_PERIOD : ZT_BINDER_REFRESH_PERIOD;
if (((now - lastBindRefresh) >= interfaceRefreshPeriod)||(restarted)) {
lastBindRefresh = now;
@@ -889,9 +891,7 @@ public:
uint64_t pktBuf[ZT_LINK_TEST_DATAGRAM_SZ / sizeof(uint64_t)];
Utils::getSecureRandom(pktBuf, ZT_LINK_TEST_DATAGRAM_SZ);
ZT_PeerList *pl = _node->peers();
- // get bindings (specifically just the sockets)
std::vector<PhySocket*> sockets = _binder.getBoundSockets();
- // interfaces
for (int i=0; i<ZT_BINDER_MAX_BINDINGS; i++) {
for(size_t j=0;j<pl->peerCount;++j) {
for (int k=0; k<(ZT_MAX_PEER_NETWORK_PATHS/4); k++) {
@@ -936,7 +936,8 @@ public:
}
// Sync information about physical network interfaces
- if ((now - lastLocalInterfaceAddressCheck) >= ZT_LOCAL_INTERFACE_CHECK_INTERVAL) {
+ int interfaceAddressCheckInterval = _multipathMode ? ZT_MULTIPATH_LOCAL_INTERFACE_CHECK_INTERVAL : ZT_LOCAL_INTERFACE_CHECK_INTERVAL;
+ if ((now - lastLocalInterfaceAddressCheck) >= interfaceAddressCheckInterval) {
lastLocalInterfaceAddressCheck = now;
_node->clearLocalInterfaceAddresses();