summaryrefslogtreecommitdiff
path: root/node/Topology.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-02-02 17:02:23 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-02-02 17:02:23 -0800
commiteeed31b39639df7e89a2e8ae641d0c3939fa4078 (patch)
tree201587d3c15a35eb0f8fe27601ffed0158e232c1 /node/Topology.cpp
parentb7148c107d04ba7b71577c764e88a02098d23480 (diff)
downloadinfinitytier-eeed31b39639df7e89a2e8ae641d0c3939fa4078.tar.gz
infinitytier-eeed31b39639df7e89a2e8ae641d0c3939fa4078.zip
Ping supernodes on surface change, and also reset TCP flag.
Diffstat (limited to 'node/Topology.cpp')
-rw-r--r--node/Topology.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/node/Topology.cpp b/node/Topology.cpp
index dd041007..d0299108 100644
--- a/node/Topology.cpp
+++ b/node/Topology.cpp
@@ -258,7 +258,7 @@ void Topology::clean(uint64_t now)
}
}
-bool Topology::updateSurface(const SharedPtr<Peer> &remotePeer,const InetAddress &mirroredAddress)
+bool Topology::updateSurface(const SharedPtr<Peer> &remotePeer,const InetAddress &mirroredAddress,uint64_t now)
{
Mutex::Lock _l(_lock);
@@ -266,10 +266,20 @@ bool Topology::updateSurface(const SharedPtr<Peer> &remotePeer,const InetAddress
return false;
if (_surface.update(mirroredAddress)) {
- // Clear non-fixed paths for all peers
+ // Clear non-fixed paths for all peers -- will force reconnect on next activity
for(std::map< Address,SharedPtr<Peer> >::const_iterator ap(_activePeers.begin());ap!=_activePeers.end();++ap)
ap->second->clearPaths(false);
+ // Reset TCP tunneling if our global addressing has changed
+ if (!mirroredAddress.isLinkLocal())
+ (const_cast <RuntimeEnvironment *>(RR))->tcpTunnelingEnabled = false;
+
+ // Ping supernodes now (other than the one we might have just heard from)
+ for(std::vector< SharedPtr<Peer> >::const_iterator sn(_supernodePeers.begin());sn!=_supernodePeers.end();++sn) {
+ if (remotePeer != *sn)
+ (*sn)->sendPing(RR,now);
+ }
+
return true;
}