mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 20:43:44 +02:00
AntiRecursion cleanup and some other minor things.
This commit is contained in:
parent
05b2c0743f
commit
9aee72099e
3 changed files with 7 additions and 5 deletions
|
@ -105,8 +105,9 @@ public:
|
||||||
const _ArItem *const end = i + ZT_ANTIRECURSION_HISTORY_SIZE;
|
const _ArItem *const end = i + ZT_ANTIRECURSION_HISTORY_SIZE;
|
||||||
while (i != end) {
|
while (i != end) {
|
||||||
#ifdef ZT_NO_TYPE_PUNNING
|
#ifdef ZT_NO_TYPE_PUNNING
|
||||||
if (!memcmp(pp,i->tail,32))
|
if (!memcmp(pp,i->tail,32)) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
const uint64_t *t = i->tail;
|
const uint64_t *t = i->tail;
|
||||||
const uint64_t *p = reinterpret_cast<const uint64_t *>(pp);
|
const uint64_t *p = reinterpret_cast<const uint64_t *>(pp);
|
||||||
|
@ -114,8 +115,9 @@ public:
|
||||||
bits |= *(t++) ^ *(p++);
|
bits |= *(t++) ^ *(p++);
|
||||||
bits |= *(t++) ^ *(p++);
|
bits |= *(t++) ^ *(p++);
|
||||||
bits |= *t ^ *p;
|
bits |= *t ^ *p;
|
||||||
if (!bits)
|
if (!bits) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ namespace ZeroTier {
|
||||||
|
|
||||||
bool Path::send(const RuntimeEnvironment *RR,const void *data,unsigned int len,uint64_t now)
|
bool Path::send(const RuntimeEnvironment *RR,const void *data,unsigned int len,uint64_t now)
|
||||||
{
|
{
|
||||||
|
RR->antiRec->logOutgoingZT(data,len);
|
||||||
if (RR->node->putPacket(_localAddress,address(),data,len)) {
|
if (RR->node->putPacket(_localAddress,address(),data,len)) {
|
||||||
sent(now);
|
sent(now);
|
||||||
RR->antiRec->logOutgoingZT(data,len);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -513,7 +513,7 @@ bool Peer::_checkPath(Path &p,const uint64_t now)
|
||||||
* MAX_PROBATION threshold the path is considred dead. */
|
* MAX_PROBATION threshold the path is considred dead. */
|
||||||
|
|
||||||
if ( (p.lastSend() > p.lastReceived()) && ((p.lastSend() - p.lastReceived()) >= ZT_PEER_DEAD_PATH_DETECTION_NO_ANSWER_TIMEOUT) && ((now - p.lastPing()) >= ZT_PEER_DEAD_PATH_DETECTION_NO_ANSWER_TIMEOUT) ) {
|
if ( (p.lastSend() > p.lastReceived()) && ((p.lastSend() - p.lastReceived()) >= ZT_PEER_DEAD_PATH_DETECTION_NO_ANSWER_TIMEOUT) && ((now - p.lastPing()) >= ZT_PEER_DEAD_PATH_DETECTION_NO_ANSWER_TIMEOUT) ) {
|
||||||
TRACE("%s(%s) has not answered, checking if dead (probation: %u)",_id.address().toString().c_str(),p.address().toString().c_str(),p.probation());
|
TRACE("%s(%s) does not seem to be answering in a timely manner, checking if dead (probation == %u)",_id.address().toString().c_str(),p.address().toString().c_str(),p.probation());
|
||||||
|
|
||||||
if ( (_vProto >= 5) && ( !((_vMajor == 1)&&(_vMinor == 1)&&(_vRevision == 0)) ) ) {
|
if ( (_vProto >= 5) && ( !((_vMajor == 1)&&(_vMinor == 1)&&(_vRevision == 0)) ) ) {
|
||||||
// 1.1.1 and newer nodes support ECHO, which is smaller -- but 1.1.0 has a bug so use HELLO there too
|
// 1.1.1 and newer nodes support ECHO, which is smaller -- but 1.1.0 has a bug so use HELLO there too
|
||||||
|
|
Loading…
Add table
Reference in a new issue