diff options
| author | Grant Limberg <glimberg@gmail.com> | 2015-10-26 18:10:27 -0700 |
|---|---|---|
| committer | Grant Limberg <glimberg@gmail.com> | 2015-10-26 18:10:27 -0700 |
| commit | 352b83252fb2617a15cde0927cc30110b729e46d (patch) | |
| tree | 38569e4f6c1c162cdaabf7ac8c9d6b7917d71ffd /node/SelfAwareness.cpp | |
| parent | a0c3083af0821db0303c62dfae9ebc560c3c147a (diff) | |
| parent | 6625d7929654803f99b7a69f56a400046314acac (diff) | |
| download | infinitytier-352b83252fb2617a15cde0927cc30110b729e46d.tar.gz infinitytier-352b83252fb2617a15cde0927cc30110b729e46d.zip | |
Merge branch 'adamierymenko-dev' into windows-ui
Diffstat (limited to 'node/SelfAwareness.cpp')
| -rw-r--r-- | node/SelfAwareness.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/node/SelfAwareness.cpp b/node/SelfAwareness.cpp index 7329322a..1b70f17c 100644 --- a/node/SelfAwareness.cpp +++ b/node/SelfAwareness.cpp @@ -94,7 +94,7 @@ void SelfAwareness::iam(const Address &reporter,const InetAddress &reporterPhysi Mutex::Lock _l(_phy_m); - PhySurfaceEntry &entry = _phy[PhySurfaceKey(reporter,scope)]; + PhySurfaceEntry &entry = _phy[PhySurfaceKey(reporter,reporterPhysicalAddress,scope)]; if ((now - entry.ts) >= ZT_SELFAWARENESS_ENTRY_TIMEOUT) { entry.mySurface = myPhysicalAddress; @@ -105,14 +105,15 @@ void SelfAwareness::iam(const Address &reporter,const InetAddress &reporterPhysi entry.ts = now; TRACE("learned physical address %s for scope %u as seen from %s(%s) (replaced %s, resetting all in scope)",myPhysicalAddress.toString().c_str(),(unsigned int)scope,reporter.toString().c_str(),reporterPhysicalAddress.toString().c_str(),entry.mySurface.toString().c_str()); - // Erase all entries (other than this one) for this scope to prevent thrashing - // Note: we should probably not use 'entry' after this + // Erase all entries in this scope that were not reported by this remote address to prevent 'thrashing' + // due to multiple reports of endpoint change. + // Don't use 'entry' after this since hash table gets modified. { Hashtable< PhySurfaceKey,PhySurfaceEntry >::Iterator i(_phy); PhySurfaceKey *k = (PhySurfaceKey *)0; PhySurfaceEntry *e = (PhySurfaceEntry *)0; while (i.next(k,e)) { - if ((k->reporter != reporter)&&(k->scope == scope)) + if ((k->reporterPhysicalAddress != reporterPhysicalAddress)&&(k->scope == scope)) _phy.erase(*k); } } |
