Correctly track direction and privilege of peer connections, pass to load tracking.

This commit is contained in:
JoelKatz
2013-01-14 23:30:13 -08:00
parent 8f6c597373
commit 33b2a20024
4 changed files with 20 additions and 7 deletions

View File

@@ -24,10 +24,12 @@ DECLARE_INSTANCE(Peer);
// Node has this long to verify its identity from connection accepted or connection attempt.
#define NODE_VERIFY_SECONDS 15
Peer::Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx, uint64 peerID) :
Peer::Peer(boost::asio::io_service& io_service, boost::asio::ssl::context& ctx, uint64 peerID, bool inbound) :
mInbound(inbound),
mHelloed(false),
mDetaching(false),
mActive(true),
mCluster(false),
mPeerId(peerID),
mSocketSsl(io_service, ctx),
mActivityTimer(io_service)
@@ -684,6 +686,13 @@ void Peer::recvHello(ripple::TMHello& packet)
<< "Peer speaks version " <<
(packet.protoversion() >> 16) << "." << (packet.protoversion() & 0xFF);
mHello = packet;
if (theApp->getUNL().nodeInCluster(mNodePublic))
{
mCluster = true;
mLoad.setPrivileged();
}
if (isOutbound())
mLoad.setOutbound();
if (mClientConnect)
{