Implement relay policy, and setting multicast limit to 0 now disables multicast on the network as would be expected.
This commit is contained in:
parent
ced8dfc639
commit
5b6d27e659
12 changed files with 159 additions and 83 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue