summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-01-05 16:48:35 -0800
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-01-05 16:48:35 -0800
commit4d94ae77b45e16272fe0c5c685cc20ece5057c32 (patch)
treefa035eb4e449636cee24f6767eb47d190131e459 /node
parentd8143a5e186faf722d2cae703f0a618c37e588ea (diff)
downloadinfinitytier-4d94ae77b45e16272fe0c5c685cc20ece5057c32.tar.gz
infinitytier-4d94ae77b45e16272fe0c5c685cc20ece5057c32.zip
simplify if
Diffstat (limited to 'node')
-rw-r--r--node/Peer.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 0f72be9f..a98d94c4 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -491,22 +491,20 @@ bool Peer::_checkPath(Path &p,const uint64_t now)
if (!p.active(now))
return false;
- if (p.lastSend() > p.lastReceived()) {
- if ((p.lastSend() - p.lastReceived()) >= 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());
-
- 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
- Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO);
- outp.armor(_key,true);
- p.send(RR,outp.data(),outp.size(),now);
- } else {
- sendHELLO(p.localAddress(),p.address(),now);
- p.sent(now);
- }
-
- p.increaseProbation();
+ if ( (p.lastSend() > p.lastReceived()) && ((p.lastSend() - p.lastReceived()) >= 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());
+
+ 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
+ Packet outp(_id.address(),RR->identity.address(),Packet::VERB_ECHO);
+ outp.armor(_key,true);
+ p.send(RR,outp.data(),outp.size(),now);
+ } else {
+ sendHELLO(p.localAddress(),p.address(),now);
+ p.sent(now);
}
+
+ p.increaseProbation();
}
return true;