From 81b12b682649c1b742f20c54449df19e12a5a9eb Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 24 Sep 2014 13:53:03 -0700 Subject: Rename the ubiquitous _r pointer to RuntimeEnvironment to RR just to be a little more consistent about using _ to denote private member variables. --- node/Peer.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'node/Peer.cpp') diff --git a/node/Peer.cpp b/node/Peer.cpp index e05352c9..a58bfe3b 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -63,7 +63,7 @@ Peer::Peer(const Identity &myIdentity,const Identity &peerIdentity) } void Peer::receive( - const RuntimeEnvironment *_r, + const RuntimeEnvironment *RR, const SharedPtr &fromSock, const InetAddress &remoteAddr, unsigned int hops, @@ -74,7 +74,7 @@ void Peer::receive( uint64_t now) { // Update system-wide last packet receive time - *((const_cast(&(_r->timeOfLastPacketReceived)))) = now; + *((const_cast(&(RR->timeOfLastPacketReceived)))) = now; // Global last receive time regardless of path _lastReceive = now; @@ -114,7 +114,7 @@ void Peer::receive( // Lock can't be locked here or it'll recurse and deadlock. if ((now - _lastAnnouncedTo) >= ((ZT_MULTICAST_LIKE_EXPIRE / 2) - 1000)) { _lastAnnouncedTo = now; - _r->sw->announceMulticastGroups(SharedPtr(this)); + RR->sw->announceMulticastGroups(SharedPtr(this)); } } @@ -124,7 +124,7 @@ void Peer::receive( _lastMulticastFrame = now; } -Path::Type Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int len,uint64_t now) +Path::Type Peer::send(const RuntimeEnvironment *RR,const void *data,unsigned int len,uint64_t now) { Mutex::Lock _l(_lock); @@ -155,8 +155,8 @@ Path::Type Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int Path *bestPath = (Path *)0; if (bestTcpOutPath) { // we have a TCP out path if (bestNormalPath) { // we have both paths, decide which to use - if (_r->tcpTunnelingEnabled) { // TCP tunneling is enabled, so use normal path only if it looks alive - if ((bestNormalPathLastReceived > _r->timeOfLastResynchronize)&&((now - bestNormalPathLastReceived) < ZT_PEER_PATH_ACTIVITY_TIMEOUT)) + if (RR->tcpTunnelingEnabled) { // TCP tunneling is enabled, so use normal path only if it looks alive + if ((bestNormalPathLastReceived > RR->timeOfLastResynchronize)&&((now - bestNormalPathLastReceived) < ZT_PEER_PATH_ACTIVITY_TIMEOUT)) bestPath = bestNormalPath; else bestPath = bestTcpOutPath; } else { // TCP tunneling is disabled, use normal path @@ -171,9 +171,9 @@ Path::Type Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int if (!bestPath) return Path::PATH_TYPE_NULL; - _r->antiRec->logOutgoingZT(data,len); + RR->antiRec->logOutgoingZT(data,len); - if (_r->sm->send(bestPath->address(),bestPath->tcp(),bestPath->type() == Path::PATH_TYPE_TCP_OUT,data,len)) { + if (RR->sm->send(bestPath->address(),bestPath->tcp(),bestPath->type() == Path::PATH_TYPE_TCP_OUT,data,len)) { bestPath->sent(now); return bestPath->type(); } @@ -181,7 +181,7 @@ Path::Type Peer::send(const RuntimeEnvironment *_r,const void *data,unsigned int return Path::PATH_TYPE_NULL; } -bool Peer::sendPing(const RuntimeEnvironment *_r,uint64_t now) +bool Peer::sendPing(const RuntimeEnvironment *RR,uint64_t now) { bool sent = false; SharedPtr self(this); @@ -200,14 +200,14 @@ bool Peer::sendPing(const RuntimeEnvironment *_r,uint64_t now) haveNormal = true; } } - const bool useTcpOut = ( (!haveNormal) || ( (_r->tcpTunnelingEnabled) && (lastNormalPingSent > _r->timeOfLastResynchronize) && (lastNormalPingSent > lastNormalReceive) && ((lastNormalPingSent - lastNormalReceive) >= ZT_TCP_TUNNEL_FAILOVER_TIMEOUT) ) ); + const bool useTcpOut = ( (!haveNormal) || ( (RR->tcpTunnelingEnabled) && (lastNormalPingSent > RR->timeOfLastResynchronize) && (lastNormalPingSent > lastNormalReceive) && ((lastNormalPingSent - lastNormalReceive) >= ZT_TCP_TUNNEL_FAILOVER_TIMEOUT) ) ); TRACE("PING %s (useTcpOut==%d)",_id.address().toString().c_str(),(int)useTcpOut); for(std::vector::iterator p(_paths.begin());p!=_paths.end();++p) { if ((useTcpOut)||(p->type() != Path::PATH_TYPE_TCP_OUT)) { p->pinged(now); // attempts to ping are logged whether they look successful or not - if (_r->sw->sendHELLO(self,*p)) { + if (RR->sw->sendHELLO(self,*p)) { p->sent(now); sent = true; } -- cgit v1.2.3