diff options
| author | Joseph Henry <josephjah@gmail.com> | 2018-05-02 15:24:14 -0700 |
|---|---|---|
| committer | Joseph Henry <josephjah@gmail.com> | 2018-05-02 15:24:14 -0700 |
| commit | 91c8e82c428cea9d9e0a6911fbd1820212871ad8 (patch) | |
| tree | 29d6d512e1a2ae8621820af0e83a86c64e38f085 /node/Peer.cpp | |
| parent | 1debe2292d85e2d377064f74246244ac607046bf (diff) | |
| download | infinitytier-91c8e82c428cea9d9e0a6911fbd1820212871ad8.tar.gz infinitytier-91c8e82c428cea9d9e0a6911fbd1820212871ad8.zip | |
Adjusted locking order of _paths_m for path pruning. Other minor multipath changes
Diffstat (limited to 'node/Peer.cpp')
| -rw-r--r-- | node/Peer.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp index bbc6d6d2..c46ed751 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -100,14 +100,17 @@ void Peer::received( path->trustedPacketReceived(now); } - if (RR->node->getMultipathMode() != ZT_MULTIPATH_NONE) { - if ((now - _lastPathPrune) > ZT_CLOSED_PATH_PRUNING_INTERVAL) { - _lastPathPrune = now; - prunePaths(); - } - for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { - if (_paths[i].p) { - _paths[i].p->measureLink(now); + { + Mutex::Lock _l(_paths_m); + if (RR->node->getMultipathMode() != ZT_MULTIPATH_NONE) { + if ((now - _lastPathPrune) > ZT_CLOSED_PATH_PRUNING_INTERVAL) { + _lastPathPrune = now; + prunePaths(); + } + for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { + if (_paths[i].p) { + _paths[i].p->measureLink(now); + } } } } @@ -386,9 +389,9 @@ SharedPtr<Path> Peer::getAppropriatePath(int64_t now, bool includeExpired) if (bestPath == ZT_MAX_PEER_NETWORK_PATHS || (numAlivePaths == 0 && numStalePaths == 0)) { return SharedPtr<Path>(); } if (numAlivePaths == 1) { - return _paths[bestPath].p; + //return _paths[bestPath].p; } if (numStalePaths == 1) { - return _paths[bestPath].p; + //return _paths[bestPath].p; } // Relative quality @@ -725,7 +728,6 @@ unsigned int Peer::doPingAndKeepalive(void *tPtr,int64_t now) unsigned int Peer::prunePaths() { - Mutex::Lock _l(_paths_m); unsigned int pruned = 0; for(unsigned int i=0;i<ZT_MAX_PEER_NETWORK_PATHS;++i) { if (_paths[i].p) { |
