summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorGrant Limberg <grant.limberg@zerotier.com>2016-11-03 12:10:50 -0700
committerGrant Limberg <grant.limberg@zerotier.com>2016-11-03 12:10:50 -0700
commit8ffae313fd5042bb4330afd98019e4ee907714cb (patch)
treebafa4a54f0a9e3ec57e4fba1b9e10b37b531b105 /node
parent8cced06a2dff66300a46e2962cd462f58096b15c (diff)
downloadinfinitytier-8ffae313fd5042bb4330afd98019e4ee907714cb.tar.gz
infinitytier-8ffae313fd5042bb4330afd98019e4ee907714cb.zip
add new files & remove old ones from VS project. Now builds & runs on Windows again
Diffstat (limited to 'node')
-rw-r--r--node/Membership.cpp28
-rw-r--r--node/Multicaster.cpp2
2 files changed, 19 insertions, 11 deletions
diff --git a/node/Membership.cpp b/node/Membership.cpp
index c8fb8e4e..d7c7c0e6 100644
--- a/node/Membership.cpp
+++ b/node/Membership.cpp
@@ -232,7 +232,7 @@ Membership::AddCredentialResult Membership::addCredential(const RuntimeEnvironme
Membership::_RemoteTag *Membership::_newTag(const uint64_t id)
{
- _RemoteTag *t;
+ _RemoteTag *t = NULL;
uint64_t minlr = 0xffffffffffffffffULL;
for(unsigned int i=0;i<ZT_MAX_NETWORK_TAGS;++i) {
if (_remoteTags[i]->id == ZT_MEMBERSHIP_CRED_ID_UNUSED) {
@@ -243,17 +243,21 @@ Membership::_RemoteTag *Membership::_newTag(const uint64_t id)
minlr = _remoteTags[i]->lastReceived;
}
}
- t->id = id;
- t->lastReceived = 0;
- t->revocationThreshold = 0;
- t->tag = Tag();
+
+ if (t) {
+ t->id = id;
+ t->lastReceived = 0;
+ t->revocationThreshold = 0;
+ t->tag = Tag();
+ }
+
std::sort(&(_remoteTags[0]),&(_remoteTags[ZT_MAX_NETWORK_TAGS]),_RemoteCredentialSorter<_RemoteTag>());
return t;
}
Membership::_RemoteCapability *Membership::_newCapability(const uint64_t id)
{
- _RemoteCapability *c;
+ _RemoteCapability *c = NULL;
uint64_t minlr = 0xffffffffffffffffULL;
for(unsigned int i=0;i<ZT_MAX_NETWORK_CAPABILITIES;++i) {
if (_remoteCaps[i]->id == ZT_MEMBERSHIP_CRED_ID_UNUSED) {
@@ -264,10 +268,14 @@ Membership::_RemoteCapability *Membership::_newCapability(const uint64_t id)
minlr = _remoteCaps[i]->lastReceived;
}
}
- c->id = id;
- c->lastReceived = 0;
- c->revocationThreshold = 0;
- c->cap = Capability();
+
+ if (c) {
+ c->id = id;
+ c->lastReceived = 0;
+ c->revocationThreshold = 0;
+ c->cap = Capability();
+ }
+
std::sort(&(_remoteCaps[0]),&(_remoteCaps[ZT_MAX_NETWORK_CAPABILITIES]),_RemoteCredentialSorter<_RemoteCapability>());
return c;
}
diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp
index 8743e8f8..17649c7b 100644
--- a/node/Multicaster.cpp
+++ b/node/Multicaster.cpp
@@ -343,7 +343,7 @@ void Multicaster::clean(uint64_t now)
{
Mutex::Lock _l(_gatherAuth_m);
_GatherAuthKey *k = (_GatherAuthKey *)0;
- uint64_t *ts = (uint64_t *)ts;
+ uint64_t *ts = NULL;
Hashtable<_GatherAuthKey,uint64_t>::Iterator i(_gatherAuth);
while (i.next(k,ts)) {
if ((now - *ts) >= ZT_MULTICAST_CREDENTIAL_EXPIRATON)