aboutsummaryrefslogtreecommitdiff
path: root/src/net.cpp
diff options
context:
space:
mode:
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());