aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/net.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2016-04-16 18:12:58 -0400
committerCory Fields <cory-nospam-@coryfields.com>2016-09-08 12:12:58 -0400
commit8ae2dac1c65349e4620422a43b7fa9d49af52c11 (patch)
tree01bce145e22f6b1319fe9b68eb71f1af05962f00 /src/rpc/net.cpp
parent502dd3a8a0bc0d12744e75f84a22cc12074c5683 (diff)
downloadbitcoin-8ae2dac1c65349e4620422a43b7fa9d49af52c11.tar.xz
net: move added node functions to CConnman
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r--src/rpc/net.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 0244da9fea..ab475f7125 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -226,23 +226,15 @@ UniValue addnode(const UniValue& params, bool fHelp)
return NullUniValue;
}
- LOCK(cs_vAddedNodes);
- vector<string>::iterator it = vAddedNodes.begin();
- for(; it != vAddedNodes.end(); it++)
- if (strNode == *it)
- break;
-
if (strCommand == "add")
{
- if (it != vAddedNodes.end())
+ if(!g_connman->AddNode(strNode))
throw JSONRPCError(RPC_CLIENT_NODE_ALREADY_ADDED, "Error: Node already added");
- vAddedNodes.push_back(strNode);
}
else if(strCommand == "remove")
{
- if (it == vAddedNodes.end())
+ if(!g_connman->RemoveAddedNode(strNode))
throw JSONRPCError(RPC_CLIENT_NODE_NOT_ADDED, "Error: Node has not been added.");
- vAddedNodes.erase(it);
}
return NullUniValue;
@@ -299,7 +291,10 @@ UniValue getaddednodeinfo(const UniValue& params, bool fHelp)
+ HelpExampleRpc("getaddednodeinfo", "true, \"192.168.0.201\"")
);
- std::vector<AddedNodeInfo> vInfo = GetAddedNodeInfo();
+ if(!g_connman)
+ throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
+
+ std::vector<AddedNodeInfo> vInfo = g_connman->GetAddedNodeInfo();
if (params.size() == 1) {
bool found = false;