mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Cleanups.
This commit is contained in:
@@ -113,7 +113,7 @@ bool ConnectionPool::savePeer(const std::string& strIp, int iPort, char code)
|
||||
Peer::pointer ConnectionPool::getPeerById(const uint64& id)
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
boost::unordered_map<uint64, Peer::pointer>::iterator it = mPeerIdMap.find(id);
|
||||
const boost::unordered_map<uint64, Peer::pointer>::iterator& it = mPeerIdMap.find(id);
|
||||
if (it == mPeerIdMap.end())
|
||||
return Peer::pointer();
|
||||
return it->second;
|
||||
@@ -283,11 +283,11 @@ void ConnectionPool::relayMessageTo(const std::set<uint64>& fromPeers, const Pac
|
||||
{ // Relay message to the specified peers
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
|
||||
BOOST_FOREACH(naPeer pair, mConnectedMap)
|
||||
BOOST_FOREACH(const uint64& peerID, fromPeers)
|
||||
{
|
||||
Peer::ref peer = pair.second;
|
||||
if (peer->isConnected() && (fromPeers.count(peer->getPeerId()) > 0))
|
||||
peer->sendPacket(msg);
|
||||
const boost::unordered_map<uint64, Peer::pointer>::iterator& it = mPeerIdMap.find(peerID);
|
||||
if ((it != mPeerIdMap.end()) && it->second->isConnected())
|
||||
it->second->sendPacket(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -418,7 +418,7 @@ bool ConnectionPool::peerConnected(Peer::ref peer, const RippleAddress& naPeer,
|
||||
else
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
boost::unordered_map<RippleAddress, Peer::pointer>::iterator itCm = mConnectedMap.find(naPeer);
|
||||
const boost::unordered_map<RippleAddress, Peer::pointer>::iterator& itCm = mConnectedMap.find(naPeer);
|
||||
|
||||
if (itCm == mConnectedMap.end())
|
||||
{
|
||||
@@ -472,10 +472,7 @@ void ConnectionPool::peerDisconnected(Peer::ref peer, const RippleAddress& naPee
|
||||
|
||||
if (naPeer.isValid())
|
||||
{
|
||||
boost::unordered_map<RippleAddress, Peer::pointer>::iterator itCm;
|
||||
|
||||
|
||||
itCm = mConnectedMap.find(naPeer);
|
||||
const boost::unordered_map<RippleAddress, Peer::pointer>::iterator& itCm = mConnectedMap.find(naPeer);
|
||||
|
||||
if (itCm == mConnectedMap.end())
|
||||
{
|
||||
@@ -575,9 +572,7 @@ void ConnectionPool::peerClosed(Peer::ref peer, const std::string& strIp, int iP
|
||||
bool bRedundant = true;
|
||||
{
|
||||
boost::mutex::scoped_lock sl(mPeerLock);
|
||||
boost::unordered_map<ipPort, Peer::pointer>::iterator itIp;
|
||||
|
||||
itIp = mIpMap.find(ipPeer);
|
||||
const boost::unordered_map<ipPort, Peer::pointer>::iterator& itIp = mIpMap.find(ipPeer);
|
||||
|
||||
if (itIp == mIpMap.end())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user