summaryrefslogtreecommitdiff
path: root/node/Network.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-07-23 09:50:10 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-07-23 09:50:10 -0700
commit3ba54c7e3559359abd8d4734aa969829309a9dab (patch)
treeaafc9a03ec70c865ab52d8f05d87703751ba84af /node/Network.cpp
parente2a2993b186c521f9521d1a9adeb150d27c15629 (diff)
downloadinfinitytier-3ba54c7e3559359abd8d4734aa969829309a9dab.tar.gz
infinitytier-3ba54c7e3559359abd8d4734aa969829309a9dab.zip
Eliminate some poorly thought out optimizations from the netconf/controller interaction,
and go ahead and bump version to 1.0.4. For a while in 1.0.3 -dev I was trying to optimize out repeated network controller requests by using a ratcheting mechanism. If the client received a network config that was indeed different from the one it had, it would respond by instantlly requesting it again. Not sure what I was thinking. It's fundamentally unsafe to respond to a message with another message of the same type -- it risks a race condition. In this case that's exactly what could happen. It just isn't worth the added complexity to avoid a tiny, tiny amount of network overhead, so I've taken this whole path out. A few extra bytes every two minutes isn't worth fretting about, but as I recall the reason for this optimization was to save CPU on the controller. This can be achieved by just caching responses in memory *there* and serving those same responses back out if they haven't changed. I think I developed that 'ratcheting' stuff before I went full time on this. It's hard to develop stuff like this without hours of sustained focus.
Diffstat (limited to 'node/Network.cpp')
-rw-r--r--node/Network.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/node/Network.cpp b/node/Network.cpp
index adc8e1b8..549219d7 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -38,6 +38,8 @@
#include "Buffer.hpp"
#include "NetworkController.hpp"
+#include "../version.h"
+
namespace ZeroTier {
const ZeroTier::MulticastGroup Network::BROADCAST(ZeroTier::MAC(0xffffffffffffULL),0);
@@ -255,9 +257,18 @@ void Network::requestConfiguration()
}
TRACE("requesting netconf for network %.16llx from controller %s",(unsigned long long)_id,controller().toString().c_str());
+
+ // TODO: in the future we will include things like join tokens here, etc.
+ Dictionary metaData;
+ metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MAJOR_VERSION,ZEROTIER_ONE_VERSION_MAJOR);
+ metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MINOR_VERSION,ZEROTIER_ONE_VERSION_MINOR);
+ metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_REVISION,ZEROTIER_ONE_VERSION_REVISION);
+ std::string mds(metaData.toString());
+
Packet outp(controller(),RR->identity.address(),Packet::VERB_NETWORK_CONFIG_REQUEST);
outp.append((uint64_t)_id);
- outp.append((uint16_t)0); // no meta-data
+ outp.append((uint16_t)mds.length());
+ outp.append((const void *)mds.data(),(unsigned int)mds.length());
{
Mutex::Lock _l(_lock);
if (_config)