diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-13 14:27:18 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2016-09-13 14:27:18 -0700 |
| commit | 5b6d27e65919cf0429feb2d8a9ce0b6164153efd (patch) | |
| tree | c39d4abc138eb2cfe1b46df7154c298156ba020b /node/Node.cpp | |
| parent | ced8dfc639f73939aacd2bae3002daa11661a14f (diff) | |
| download | infinitytier-5b6d27e65919cf0429feb2d8a9ce0b6164153efd.tar.gz infinitytier-5b6d27e65919cf0429feb2d8a9ce0b6164153efd.zip | |
Implement relay policy, and setting multicast limit to 0 now disables multicast on the network as would be expected.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 59794854..51f1b5c0 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -71,7 +71,8 @@ Node::Node( _prngStreamPtr(0), _now(now), _lastPingCheck(0), - _lastHousekeepingRun(0) + _lastHousekeepingRun(0), + _relayPolicy(ZT_RELAY_POLICY_TRUSTED) { _online = false; @@ -118,6 +119,9 @@ Node::Node( throw; } + if (RR->topology->amRoot()) + _relayPolicy = ZT_RELAY_POLICY_ALWAYS; + postEvent(ZT_EVENT_UP); } @@ -131,6 +135,7 @@ Node::~Node() delete RR->topology; delete RR->mc; delete RR->sw; + #ifdef ZT_ENABLE_CLUSTER delete RR->cluster; #endif @@ -319,6 +324,12 @@ ZT_ResultCode Node::processBackgroundTasks(uint64_t now,volatile uint64_t *nextB return ZT_RESULT_OK; } +ZT_ResultCode Node::setRelayPolicy(enum ZT_RelayPolicy rp) +{ + _relayPolicy = rp; + return ZT_RESULT_OK; +} + ZT_ResultCode Node::join(uint64_t nwid,void *uptr) { Mutex::Lock _l(_networks_m); @@ -824,6 +835,15 @@ enum ZT_ResultCode ZT_Node_processBackgroundTasks(ZT_Node *node,uint64_t now,vol } } +enum ZT_ResultCode ZT_Node_setRelayPolicy(ZT_Node *node,enum ZT_RelayPolicy rp) +{ + try { + return reinterpret_cast<ZeroTier::Node *>(node)->setRelayPolicy(rp); + } catch ( ... ) { + return ZT_RESULT_FATAL_ERROR_INTERNAL; + } +} + enum ZT_ResultCode ZT_Node_join(ZT_Node *node,uint64_t nwid,void *uptr) { try { |
