mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Cleanup.
This commit is contained in:
parent
20ae12d385
commit
1003455160
3 changed files with 15 additions and 2 deletions
|
@ -18,6 +18,16 @@
|
|||
|
||||
namespace ZeroTier {
|
||||
|
||||
Locator::Locator(const char *const str) noexcept
|
||||
{
|
||||
if (!fromString(str)) {
|
||||
m_ts = 0;
|
||||
m_signer.zero();
|
||||
m_endpoints.clear();
|
||||
m_signature.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool Locator::add(const Endpoint &ep)
|
||||
{
|
||||
if (m_endpoints.size() < ZT_LOCATOR_MAX_ENDPOINTS) {
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
m_ts(0)
|
||||
{}
|
||||
|
||||
explicit Locator(const char *const str) noexcept;
|
||||
|
||||
ZT_INLINE Locator(const Locator &loc) noexcept :
|
||||
m_ts(loc.m_ts),
|
||||
m_signer(loc.m_signer),
|
||||
|
|
|
@ -124,8 +124,9 @@ Node::Node(void *uPtr, void *tPtr, const struct ZT_Node_Callbacks *callbacks, in
|
|||
for(unsigned int i=0;i<1023;++i)
|
||||
RR->randomPrivilegedPortOrder[i] = (uint16_t)(i + 1);
|
||||
for(unsigned int i=0;i<512;++i) {
|
||||
const unsigned int a = (unsigned int)Utils::random() % 1023;
|
||||
const unsigned int b = (unsigned int)Utils::random() % 1023;
|
||||
uint64_t rn = Utils::random();
|
||||
const unsigned int a = (unsigned int)rn % 1023;
|
||||
const unsigned int b = (unsigned int)(rn >> 32U) % 1023;
|
||||
if (a != b) {
|
||||
const uint16_t tmp = RR->randomPrivilegedPortOrder[a];
|
||||
RR->randomPrivilegedPortOrder[a] = RR->randomPrivilegedPortOrder[b];
|
||||
|
|
Loading…
Add table
Reference in a new issue