aboutsummaryrefslogtreecommitdiff
path: root/src/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/net.cpp
parent502dd3a8a0bc0d12744e75f84a22cc12074c5683 (diff)
downloadbitcoin-8ae2dac1c65349e4620422a43b7fa9d49af52c11.tar.xz
net: move added node functions to CConnman
Diffstat (limited to 'src/net.cpp')
-rw-r--r--src/net.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp
index 045939c2ea..8ca6df0f9b 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -91,9 +91,6 @@ std::vector<CNode*> vNodes;
CCriticalSection cs_vNodes;
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
-std::vector<std::string> vAddedNodes;
-CCriticalSection cs_vAddedNodes;
-
NodeId nLastNodeId = 0;
CCriticalSection cs_nLastNodeId;
@@ -1718,7 +1715,7 @@ void CConnman::ThreadOpenConnections()
}
}
-std::vector<AddedNodeInfo> GetAddedNodeInfo()
+std::vector<AddedNodeInfo> CConnman::GetAddedNodeInfo()
{
std::vector<AddedNodeInfo> ret;
@@ -2246,6 +2243,30 @@ std::vector<CAddress> CConnman::GetAddresses()
return addrman.GetAddr();
}
+bool CConnman::AddNode(const std::string& strNode)
+{
+ LOCK(cs_vAddedNodes);
+ for(std::vector<std::string>::const_iterator it = vAddedNodes.begin(); it != vAddedNodes.end(); ++it) {
+ if (strNode == *it)
+ return false;
+ }
+
+ vAddedNodes.push_back(strNode);
+ return true;
+}
+
+bool CConnman::RemoveAddedNode(const std::string& strNode)
+{
+ LOCK(cs_vAddedNodes);
+ for(std::vector<std::string>::iterator it = vAddedNodes.begin(); it != vAddedNodes.end(); ++it) {
+ if (strNode == *it) {
+ vAddedNodes.erase(it);
+ return true;
+ }
+ }
+ return false;
+}
+
void RelayTransaction(const CTransaction& tx)
{
CInv inv(MSG_TX, tx.GetHash());