aboutsummaryrefslogtreecommitdiff
path: root/src/rpcnet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-05 07:00:57 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-05 07:11:44 +0200
commit3fce72eaa3ea75aa911e32c4d96313848338cede (patch)
tree8604bec497a9137315589e468ba8f79e1f7a0fd7 /src/rpcnet.cpp
parentd38cd47fe3d65d3d6d867d6fb61a4ce24f0747b3 (diff)
parenta9ac95c1bc67726a7d6eecb35d7650eed6c89361 (diff)
Merge pull request #6206
a9ac95c use const references where appropriate (Philip Kaufmann)
Diffstat (limited to 'src/rpcnet.cpp')
-rw-r--r--src/rpcnet.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 59253e72af..a36831de2a 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -253,19 +253,20 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
if (params.size() == 1)
{
LOCK(cs_vAddedNodes);
- BOOST_FOREACH(string& strAddNode, vAddedNodes)
+ BOOST_FOREACH(const std::string& strAddNode, vAddedNodes)
laddedNodes.push_back(strAddNode);
}
else
{
string strNode = params[1].get_str();
LOCK(cs_vAddedNodes);
- BOOST_FOREACH(string& strAddNode, vAddedNodes)
+ BOOST_FOREACH(const std::string& strAddNode, vAddedNodes) {
if (strAddNode == strNode)
{
laddedNodes.push_back(strAddNode);
break;
}
+ }
if (laddedNodes.size() == 0)
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
}
@@ -273,8 +274,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
UniValue ret(UniValue::VARR);
if (!fDns)
{
- BOOST_FOREACH(string& strAddNode, laddedNodes)
- {
+ BOOST_FOREACH (const std::string& strAddNode, laddedNodes) {
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("addednode", strAddNode));
ret.push_back(obj);
@@ -283,8 +283,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
}
list<pair<string, vector<CService> > > laddedAddreses(0);
- BOOST_FOREACH(string& strAddNode, laddedNodes)
- {
+ BOOST_FOREACH(const std::string& strAddNode, laddedNodes) {
vector<CService> vservNode(0);
if(Lookup(strAddNode.c_str(), vservNode, Params().GetDefaultPort(), fNameLookup, 0))
laddedAddreses.push_back(make_pair(strAddNode, vservNode));
@@ -306,12 +305,11 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
UniValue addresses(UniValue::VARR);
bool fConnected = false;
- BOOST_FOREACH(CService& addrNode, it->second)
- {
+ BOOST_FOREACH(const CService& addrNode, it->second) {
bool fFound = false;
UniValue node(UniValue::VOBJ);
node.push_back(Pair("address", addrNode.ToString()));
- BOOST_FOREACH(CNode* pnode, vNodes)
+ BOOST_FOREACH(CNode* pnode, vNodes) {
if (pnode->addr == addrNode)
{
fFound = true;
@@ -319,6 +317,7 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
node.push_back(Pair("connected", pnode->fInbound ? "inbound" : "outbound"));
break;
}
+ }
if (!fFound)
node.push_back(Pair("connected", "false"));
addresses.push_back(node);