Browse Source

Don't keep connections up longer than the alive timeout (unless they are relays or roots)

Adam Ierymenko 9 years ago
parent
commit
489e1a5b83
1 changed files with 4 additions and 2 deletions
  1. 4 2
      node/Node.cpp

+ 4 - 2
node/Node.cpp

@@ -206,8 +206,10 @@ public:
 			}
 			}
 		}
 		}
 
 
-		if ((!p->doPingAndKeepalive(RR,_now))&&(stableEndpoint))
-			p->attemptToContactAt(RR,InetAddress(),stableEndpoint,_now);
+		if ((p->alive(_now))||(upstream)) {
+			if ((!p->doPingAndKeepalive(RR,_now))&&(stableEndpoint))
+				p->attemptToContactAt(RR,InetAddress(),stableEndpoint,_now);
+		}
 
 
 		if (upstream)
 		if (upstream)
 			lastReceiveFromUpstream = std::max(p->lastReceive(),lastReceiveFromUpstream);
 			lastReceiveFromUpstream = std::max(p->lastReceive(),lastReceiveFromUpstream);