diff --git a/node/Topology.cpp b/node/Topology.cpp index 985dd5d8..d179d8e6 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -156,6 +156,40 @@ void Topology::doPeriodicTasks(void *tPtr,int64_t now) } } +void Topology::setPhysicalPathConfiguration(const struct sockaddr_storage *pathNetwork,const ZT_PhysicalPathConfiguration *pathConfig) +{ + if (!pathNetwork) { + _numConfiguredPhysicalPaths = 0; + } else { + std::map cpaths; + for(unsigned int i=0,j=_numConfiguredPhysicalPaths;i ZT_MAX_PHYSMTU) + pc.mtu = ZT_MAX_PHYSMTU; + + cpaths[*(reinterpret_cast(pathNetwork))] = pc; + } else { + cpaths.erase(*(reinterpret_cast(pathNetwork))); + } + + unsigned int cnt = 0; + for(std::map::const_iterator i(cpaths.begin());((i!=cpaths.end())&&(cntfirst; + _physicalPathConfig[cnt].second = i->second; + ++cnt; + } + _numConfiguredPhysicalPaths = cnt; + } +} + void Topology::_savePeer(void *tPtr,const SharedPtr &peer) { try { diff --git a/node/Topology.hpp b/node/Topology.hpp index 35c4e7ab..b7f387a1 100644 --- a/node/Topology.hpp +++ b/node/Topology.hpp @@ -171,6 +171,7 @@ public: */ inline std::vector
upstreamAddresses() const { + // TODO return std::vector
(); } @@ -293,39 +294,7 @@ public: /** * Set or clear physical path configuration (called via Node::setPhysicalPathConfiguration) */ - inline void setPhysicalPathConfiguration(const struct sockaddr_storage *pathNetwork,const ZT_PhysicalPathConfiguration *pathConfig) - { - if (!pathNetwork) { - _numConfiguredPhysicalPaths = 0; - } else { - std::map cpaths; - for(unsigned int i=0,j=_numConfiguredPhysicalPaths;i ZT_MAX_PHYSMTU) - pc.mtu = ZT_MAX_PHYSMTU; - - cpaths[*(reinterpret_cast(pathNetwork))] = pc; - } else { - cpaths.erase(*(reinterpret_cast(pathNetwork))); - } - - unsigned int cnt = 0; - for(std::map::const_iterator i(cpaths.begin());((i!=cpaths.end())&&(cntfirst; - _physicalPathConfig[cnt].second = i->second; - ++cnt; - } - _numConfiguredPhysicalPaths = cnt; - } - } + void setPhysicalPathConfiguration(const struct sockaddr_storage *pathNetwork,const ZT_PhysicalPathConfiguration *pathConfig); private: Identity _getIdentity(void *tPtr,const Address &zta); @@ -335,7 +304,7 @@ private: const RuntimeEnvironment *const RR; std::pair _physicalPathConfig[ZT_MAX_CONFIGURABLE_PATHS]; - volatile unsigned int _numConfiguredPhysicalPaths; + unsigned int _numConfiguredPhysicalPaths; Hashtable< Address,SharedPtr > _peers; Mutex _peers_m;