summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-24 17:56:35 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-08-24 17:56:35 -0700
commit584228b2b5ff91a3db4699174bbefe1540d4ce59 (patch)
tree36c03f06461ed308cbe26681308c8279a15f13ac /node
parentcd3683f2bae5e706b5afdf40eee2b5f486f5aedb (diff)
downloadinfinitytier-584228b2b5ff91a3db4699174bbefe1540d4ce59.tar.gz
infinitytier-584228b2b5ff91a3db4699174bbefe1540d4ce59.zip
Dead code removal, and get rid of reliable() because we will no longer make that distinction.
Diffstat (limited to 'node')
-rw-r--r--node/Path.hpp42
-rw-r--r--node/Peer.cpp4
2 files changed, 1 insertions, 45 deletions
diff --git a/node/Path.hpp b/node/Path.hpp
index ecf4be24..ca5dd98f 100644
--- a/node/Path.hpp
+++ b/node/Path.hpp
@@ -248,16 +248,6 @@ public:
}
/**
- * @return True if path is considered reliable (no NAT keepalives etc. are needed)
- */
- inline bool reliable() const throw()
- {
- if ((_addr.ss_family == AF_INET)||(_addr.ss_family == AF_INET6))
- return ((_ipScope != InetAddress::IP_SCOPE_GLOBAL)&&(_ipScope != InetAddress::IP_SCOPE_PSEUDOPRIVATE));
- return true;
- }
-
- /**
* @return True if address is non-NULL
*/
inline operator bool() const throw() { return (_addr); }
@@ -313,38 +303,6 @@ public:
*/
inline void increaseProbation() { ++_probation; }
- template<unsigned int C>
- inline void serialize(Buffer<C> &b) const
- {
- b.append((uint8_t)2); // version
- b.append((uint64_t)_lastSend);
- b.append((uint64_t)_lastPing);
- b.append((uint64_t)_lastKeepalive);
- b.append((uint64_t)_lastReceived);
- _addr.serialize(b);
- _localAddress.serialize(b);
- b.append((uint16_t)_flags);
- b.append((uint16_t)_probation);
- }
-
- template<unsigned int C>
- inline unsigned int deserialize(const Buffer<C> &b,unsigned int startAt = 0)
- {
- unsigned int p = startAt;
- if (b[p++] != 2)
- throw std::invalid_argument("invalid serialized Path");
- _lastSend = b.template at<uint64_t>(p); p += 8;
- _lastPing = b.template at<uint64_t>(p); p += 8;
- _lastKeepalive = b.template at<uint64_t>(p); p += 8;
- _lastReceived = b.template at<uint64_t>(p); p += 8;
- p += _addr.deserialize(b,p);
- p += _localAddress.deserialize(b,p);
- _flags = b.template at<uint16_t>(p); p += 2;
- _probation = b.template at<uint16_t>(p); p += 2;
- _ipScope = _addr.ipScope();
- return (p - startAt);
- }
-
inline bool operator==(const Path &p) const { return ((p._addr == _addr)&&(p._localAddress == _localAddress)); }
inline bool operator!=(const Path &p) const { return ((p._addr != _addr)||(p._localAddress != _localAddress)); }
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 7691408e..01492be1 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -230,13 +230,11 @@ bool Peer::doPingAndKeepalive(uint64_t now,int inetAddressFamily)
sendHELLO(p->localAddress(),p->address(),now);
p->sent(now);
p->pinged(now);
- } else if ( ((now - std::max(p->lastSend(),p->lastKeepalive())) >= ZT_NAT_KEEPALIVE_DELAY) && (!p->reliable()) ) {
+ } else if ((now - std::max(p->lastSend(),p->lastKeepalive())) >= ZT_NAT_KEEPALIVE_DELAY) {
//TRACE("NAT keepalive %s(%s) after %llums/%llums send/receive inactivity",_id.address().toString().c_str(),p->address().toString().c_str(),now - p->lastSend(),now - p->lastReceived());
_natKeepaliveBuf += (uint32_t)((now * 0x9e3779b1) >> 1); // tumble this around to send constantly varying (meaningless) payloads
RR->node->putPacket(p->localAddress(),p->address(),&_natKeepaliveBuf,sizeof(_natKeepaliveBuf));
p->sentKeepalive(now);
- } else {
- //TRACE("no PING or NAT keepalive: addr==%s reliable==%d %llums/%llums send/receive inactivity",p->address().toString().c_str(),(int)p->reliable(),now - p->lastSend(),now - p->lastReceived());
}
return true;
}