From 502dd3a8a0bc0d12744e75f84a22cc12074c5683 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Sat, 16 Apr 2016 17:51:01 -0400 Subject: [PATCH] net: Add oneshot functions to CConnman --- src/init.cpp | 2 +- src/net.cpp | 5 +---- src/net.h | 4 +++- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index b0ffb7a40e..719b648c04 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1230,7 +1230,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) } BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"]) - AddOneShot(strDest); + connman.AddOneShot(strDest); #if ENABLE_ZMQ pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs); diff --git a/src/net.cpp b/src/net.cpp index eeb84fca7a..045939c2ea 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -91,9 +91,6 @@ std::vector vNodes; CCriticalSection cs_vNodes; limitedmap mapAlreadyAskedFor(MAX_INV_SZ); -static std::deque vOneShots; -CCriticalSection cs_vOneShots; - std::vector vAddedNodes; CCriticalSection cs_vAddedNodes; @@ -107,7 +104,7 @@ boost::condition_variable messageHandlerCondition; static CNodeSignals g_signals; CNodeSignals& GetNodeSignals() { return g_signals; } -void AddOneShot(const std::string& strDest) +void CConnman::AddOneShot(const std::string& strDest) { LOCK(cs_vOneShots); vOneShots.push_back(strDest); diff --git a/src/net.h b/src/net.h index 65dafb4fd9..81de7f5a98 100644 --- a/src/net.h +++ b/src/net.h @@ -87,7 +87,6 @@ unsigned int SendBufferSize(); typedef int NodeId; -void AddOneShot(const std::string& strDest); CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CSubNet& subNet); CNode* FindNode(const std::string& addrName); @@ -137,6 +136,7 @@ public: void GetBanned(banmap_t &banmap); void SetBanned(const banmap_t &banmap); + void AddOneShot(const std::string& strDest); private: struct ListenSocket { SOCKET socket; @@ -171,6 +171,8 @@ private: bool setBannedIsDirty; bool fAddressesInitialized; CAddrMan addrman; + std::deque vOneShots; + CCriticalSection cs_vOneShots; }; extern std::unique_ptr g_connman; void MapPort(bool fUseUPnP);