summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-21 14:18:35 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-03-21 14:18:35 -0700
commit8d3eb1a2582ddfa7e1eba9f4e1a1dd4cdef3195e (patch)
treec8374878782770250c58019ca81da5f62d871211
parent33ad3deaee06df288731064aa0663cb2806ebea0 (diff)
downloadinfinitytier-8d3eb1a2582ddfa7e1eba9f4e1a1dd4cdef3195e.tar.gz
infinitytier-8d3eb1a2582ddfa7e1eba9f4e1a1dd4cdef3195e.zip
A few renamings to be consistent.
-rw-r--r--node/PacketDecoder.cpp24
-rw-r--r--node/Peer.cpp2
-rw-r--r--node/Peer.hpp4
-rw-r--r--node/Topology.cpp10
4 files changed, 20 insertions, 20 deletions
diff --git a/node/PacketDecoder.cpp b/node/PacketDecoder.cpp
index 43ed8c69..329aab78 100644
--- a/node/PacketDecoder.cpp
+++ b/node/PacketDecoder.cpp
@@ -82,7 +82,7 @@ bool PacketDecoder::tryDecode(const RuntimeEnvironment *_r)
switch(verb()) {
case Packet::VERB_NOP:
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NOP,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NOP,0,Packet::VERB_NOP,Utils::now());
return true;
case Packet::VERB_HELLO:
return _doHELLO(_r); // legal, but why? :)
@@ -156,7 +156,7 @@ bool PacketDecoder::_doERROR(const RuntimeEnvironment *_r,const SharedPtr<Peer>
break;
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_ERROR,inRePacketId,inReVerb,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_ERROR,inRePacketId,inReVerb,Utils::now());
} catch (std::exception &ex) {
TRACE("dropped ERROR from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),ex.what());
} catch ( ... ) {
@@ -246,7 +246,7 @@ bool PacketDecoder::_doHELLO(const RuntimeEnvironment *_r)
peer = _r->topology->addPeer(newPeer);
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_HELLO,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_HELLO,0,Packet::VERB_NOP,Utils::now());
peer->setRemoteVersion(vMajor,vMinor,vRevision);
// If a supernode has a version higher than ours, this causes a software
@@ -324,7 +324,7 @@ bool PacketDecoder::_doOK(const RuntimeEnvironment *_r,const SharedPtr<Peer> &pe
break;
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_OK,inRePacketId,inReVerb,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_OK,inRePacketId,inReVerb,Utils::now());
} catch (std::exception &ex) {
TRACE("dropped OK from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),ex.what());
} catch ( ... ) {
@@ -358,7 +358,7 @@ bool PacketDecoder::_doWHOIS(const RuntimeEnvironment *_r,const SharedPtr<Peer>
} else {
TRACE("dropped WHOIS from %s(%s): missing or invalid address",source().toString().c_str(),_remoteAddress.toString().c_str());
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_WHOIS,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_WHOIS,0,Packet::VERB_NOP,Utils::now());
return true;
}
@@ -387,7 +387,7 @@ bool PacketDecoder::_doRENDEZVOUS(const RuntimeEnvironment *_r,const SharedPtr<P
if ((port > 0)&&((addrlen == 4)||(addrlen == 16))) {
InetAddress atAddr(field(ZT_PROTO_VERB_RENDEZVOUS_IDX_ADDRESS,addrlen),addrlen,port);
TRACE("RENDEZVOUS from %s says %s might be at %s, starting NAT-t",source().toString().c_str(),with.toString().c_str(),atAddr.toString().c_str());
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_RENDEZVOUS,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_RENDEZVOUS,0,Packet::VERB_NOP,Utils::now());
_r->sw->contact(withPeer,atAddr);
} else {
TRACE("dropped corrupt RENDEZVOUS from %s(%s) (bad address or port)",source().toString().c_str(),_remoteAddress.toString().c_str());
@@ -426,7 +426,7 @@ bool PacketDecoder::_doFRAME(const RuntimeEnvironment *_r,const SharedPtr<Peer>
// we receive unicast frames from it. This is called "implicit social
// ordering" in other docs.
_r->mc->bringCloser(network->id(),source());
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_FRAME,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_FRAME,0,Packet::VERB_NOP,Utils::now());
} else {
TRACE("dropped FRAME from %s(%s): sender not a member of closed network %.16llx",source().toString().c_str(),_remoteAddress.toString().c_str(),network->id());
@@ -583,7 +583,7 @@ bool PacketDecoder::_doMULTICAST_FRAME(const RuntimeEnvironment *_r,const Shared
#endif
// At this point the frame is basically valid, so we can call it a receive
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_MULTICAST_FRAME,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_MULTICAST_FRAME,0,Packet::VERB_NOP,Utils::now());
// This gets updated later in most cases but start with the global limit.
unsigned int maxDepth = ZT_MULTICAST_GLOBAL_MAX_DEPTH;
@@ -834,7 +834,7 @@ bool PacketDecoder::_doMULTICAST_LIKE(const RuntimeEnvironment *_r,const SharedP
}
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_MULTICAST_LIKE,0,Packet::VERB_NOP,now);
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_MULTICAST_LIKE,0,Packet::VERB_NOP,now);
} catch (std::exception &ex) {
TRACE("dropped MULTICAST_LIKE from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),ex.what());
} catch ( ... ) {
@@ -870,7 +870,7 @@ bool PacketDecoder::_doNETWORK_MEMBERSHIP_CERTIFICATE(const RuntimeEnvironment *
}
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_MEMBERSHIP_CERTIFICATE,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_MEMBERSHIP_CERTIFICATE,0,Packet::VERB_NOP,Utils::now());
} catch (std::exception &ex) {
TRACE("dropped NETWORK_MEMBERSHIP_CERTIFICATE from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),ex.what());
} catch ( ... ) {
@@ -913,7 +913,7 @@ bool PacketDecoder::_doNETWORK_CONFIG_REQUEST(const RuntimeEnvironment *_r,const
#ifndef __WINDOWS__
}
#endif // !__WINDOWS__
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REQUEST,0,Packet::VERB_NOP,Utils::now());
} catch (std::exception &exc) {
TRACE("dropped NETWORK_CONFIG_REQUEST from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),exc.what());
} catch ( ... ) {
@@ -934,7 +934,7 @@ bool PacketDecoder::_doNETWORK_CONFIG_REFRESH(const RuntimeEnvironment *_r,const
nw->requestConfiguration();
}
}
- peer->onReceive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REFRESH,0,Packet::VERB_NOP,Utils::now());
+ peer->receive(_r,_fromSock,_remoteAddress,hops(),packetId(),Packet::VERB_NETWORK_CONFIG_REFRESH,0,Packet::VERB_NOP,Utils::now());
} catch (std::exception &exc) {
TRACE("dropped NETWORK_CONFIG_REFRESH from %s(%s): unexpected exception: %s",source().toString().c_str(),_remoteAddress.toString().c_str(),exc.what());
} catch ( ... ) {
diff --git a/node/Peer.cpp b/node/Peer.cpp
index 3d4b3484..dd6499c6 100644
--- a/node/Peer.cpp
+++ b/node/Peer.cpp
@@ -58,7 +58,7 @@ Peer::Peer(const Identity &myIdentity,const Identity &peerIdentity)
throw std::runtime_error("new peer identity key agreement failed");
}
-void Peer::onReceive(
+void Peer::receive(
const RuntimeEnvironment *_r,
const SharedPtr<Socket> &fromSock,
const InetAddress &remoteAddr,
diff --git a/node/Peer.hpp b/node/Peer.hpp
index d9405b94..9687d7cc 100644
--- a/node/Peer.hpp
+++ b/node/Peer.hpp
@@ -89,7 +89,7 @@ public:
/**
* @param now New time of last use
*/
- inline void setLastUsed(uint64_t now)
+ inline void use(uint64_t now)
throw()
{
_lastUsed = now;
@@ -118,7 +118,7 @@ public:
* @param inReVerb Verb in reply to (for OK/ERROR, VERB_NOP otherwise)
* @param now Current time
*/
- void onReceive(
+ void receive(
const RuntimeEnvironment *_r,
const SharedPtr<Socket> &fromSock,
const InetAddress &remoteAddr,
diff --git a/node/Topology.cpp b/node/Topology.cpp
index d3667654..2211d126 100644
--- a/node/Topology.cpp
+++ b/node/Topology.cpp
@@ -67,7 +67,7 @@ void Topology::setSupernodes(const std::map< Identity,std::vector<InetAddress> >
for(std::vector<InetAddress>::const_iterator j(i->second.begin());j!=i->second.end();++j) {
p->addPath(Path(*j,false,true));
}
- p->setLastUsed(now);
+ p->use(now);
_supernodePeers.push_back(p);
}
_supernodeAddresses.insert(i->first.address());
@@ -85,7 +85,7 @@ SharedPtr<Peer> Topology::addPeer(const SharedPtr<Peer> &peer)
uint64_t now = Utils::now();
Mutex::Lock _l(_activePeers_m);
SharedPtr<Peer> p(_activePeers.insert(std::pair< Address,SharedPtr<Peer> >(peer->address(),peer)).first->second);
- p->setLastUsed(now);
+ p->use(now);
saveIdentity(p->identity());
return p;
}
@@ -100,7 +100,7 @@ SharedPtr<Peer> Topology::getPeer(const Address &zta)
Mutex::Lock _l(_activePeers_m);
std::map< Address,SharedPtr<Peer> >::const_iterator ap(_activePeers.find(zta));
if ((ap != _activePeers.end())&&(ap->second)) {
- ap->second->setLastUsed(now);
+ ap->second->use(now);
return ap->second;
}
return SharedPtr<Peer>();
@@ -176,7 +176,7 @@ keep_searching_for_supernodes:
}
if (bestSupernode) {
- bestSupernode->setLastUsed(now);
+ bestSupernode->use(now);
return bestSupernode;
} else if (strictAvoid)
return SharedPtr<Peer>();
@@ -199,7 +199,7 @@ keep_searching_for_supernodes:
}
if (bestSupernode)
- bestSupernode->setLastUsed(now);
+ bestSupernode->use(now);
return bestSupernode;
}