From 3883ac08c7736c9695f100c7937af089e00359d9 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 12 Jan 2016 13:17:30 -0800 Subject: [PATCH] Docs and cleanup. --- node/Network.cpp | 12 ++++++------ node/Network.hpp | 4 ++-- node/Peer.cpp | 2 -- node/Peer.hpp | 7 +------ 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/node/Network.cpp b/node/Network.cpp index 7a4a187d4..bb889937d 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -47,7 +47,7 @@ const ZeroTier::MulticastGroup Network::BROADCAST(ZeroTier::MAC(0xffffffffffffUL Network::Network(const RuntimeEnvironment *renv,uint64_t nwid,void *uptr) : RR(renv), - _uptr(uptr), + _uPtr(uptr), _id(nwid), _mac(renv->identity.address(),nwid), _enabled(true), @@ -89,7 +89,7 @@ Network::Network(const RuntimeEnvironment *renv,uint64_t nwid,void *uptr) : if (!_portInitialized) { ZT_VirtualNetworkConfig ctmp; _externalConfig(&ctmp); - _portError = RR->node->configureVirtualNetworkPort(_id,&_uptr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp); + _portError = RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp); _portInitialized = true; } } @@ -101,11 +101,11 @@ Network::~Network() char n[128]; if (_destroyed) { - RR->node->configureVirtualNetworkPort(_id,&_uptr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY,&ctmp); + RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY,&ctmp); Utils::snprintf(n,sizeof(n),"networks.d/%.16llx.conf",_id); RR->node->dataStoreDelete(n); } else { - RR->node->configureVirtualNetworkPort(_id,&_uptr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN,&ctmp); + RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN,&ctmp); } } @@ -174,7 +174,7 @@ bool Network::applyConfiguration(const SharedPtr &conf) portInitialized = _portInitialized; _portInitialized = true; } - _portError = RR->node->configureVirtualNetworkPort(_id,&_uptr,(portInitialized) ? ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE : ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp); + _portError = RR->node->configureVirtualNetworkPort(_id,&_uPtr,(portInitialized) ? ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE : ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_UP,&ctmp); return true; } else { TRACE("ignored invalid configuration for network %.16llx (configuration contains mismatched network ID or issued-to address)",(unsigned long long)_id); @@ -332,7 +332,7 @@ void Network::setEnabled(bool enabled) _enabled = enabled; ZT_VirtualNetworkConfig ctmp; _externalConfig(&ctmp); - _portError = RR->node->configureVirtualNetworkPort(_id,&_uptr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE,&ctmp); + _portError = RR->node->configureVirtualNetworkPort(_id,&_uPtr,ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE,&ctmp); } } diff --git a/node/Network.hpp b/node/Network.hpp index cb696d12b..3cf839635 100644 --- a/node/Network.hpp +++ b/node/Network.hpp @@ -335,7 +335,7 @@ public: /** * @return Pointer to user PTR (modifiable user ptr used in API) */ - inline void **userPtr() throw() { return &_uptr; } + inline void **userPtr() throw() { return &_uPtr; } inline bool operator==(const Network &n) const throw() { return (_id == n._id); } inline bool operator!=(const Network &n) const throw() { return (_id != n._id); } @@ -354,7 +354,7 @@ private: std::vector _allMulticastGroups() const; const RuntimeEnvironment *RR; - void *_uptr; + void *_uPtr; uint64_t _id; MAC _mac; // local MAC address volatile bool _enabled; diff --git a/node/Peer.cpp b/node/Peer.cpp index bcfda7229..ca194f8d4 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -183,7 +183,6 @@ void Peer::received( TRACE("got %s via unknown path %s(%s), confirming...",Packet::verbString(verb),_id.address().toString().c_str(),remoteAddr.toString().c_str()); if ( (_vProto >= 5) && ( !((_vMajor == 1)&&(_vMinor == 1)&&(_vRevision == 0)) ) ) { - // 1.1.1 and newer nodes support ECHO, which is smaller -- but 1.1.0 has a bug so use HELLO there too Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO); outp.armor(_key,true); RR->node->putPacket(localAddr,remoteAddr,outp.data(),outp.size()); @@ -498,7 +497,6 @@ bool Peer::_checkPath(Path &p,const uint64_t now) TRACE("%s(%s) does not seem to be answering in a timely manner, checking if dead (probation == %u)",_id.address().toString().c_str(),p.address().toString().c_str(),p.probation()); if ( (_vProto >= 5) && ( !((_vMajor == 1)&&(_vMinor == 1)&&(_vRevision == 0)) ) ) { - // 1.1.1 and newer nodes support ECHO, which is smaller -- but 1.1.0 has a bug so use HELLO there too Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO); outp.armor(_key,true); p.send(RR,outp.data(),outp.size(),now); diff --git a/node/Peer.hpp b/node/Peer.hpp index e40f576a9..7d4001969 100644 --- a/node/Peer.hpp +++ b/node/Peer.hpp @@ -186,7 +186,7 @@ public: void pushDirectPaths(Path *path,uint64_t now,bool force); /** - * @return All known direct paths to this peer + * @return All known direct paths to this peer (active or inactive) */ inline std::vector paths() const { @@ -216,11 +216,6 @@ public: */ inline uint64_t lastFrame() const throw() { return std::max(_lastUnicastFrame,_lastMulticastFrame); } - /** - * @return Time we last announced state TO this peer, such as multicast LIKEs - */ - inline uint64_t lastAnnouncedTo() const throw() { return _lastAnnouncedTo; } - /** * @return True if this peer has sent us real network traffic recently */