net: Add oneshot functions to CConnman

This commit is contained in:
Cory Fields 2016-04-16 17:51:01 -04:00
parent a0f3d3cdad
commit 502dd3a8a0
3 changed files with 5 additions and 6 deletions

View File

@ -1230,7 +1230,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
} }
BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"]) BOOST_FOREACH(const std::string& strDest, mapMultiArgs["-seednode"])
AddOneShot(strDest); connman.AddOneShot(strDest);
#if ENABLE_ZMQ #if ENABLE_ZMQ
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs); pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs);

View File

@ -91,9 +91,6 @@ std::vector<CNode*> vNodes;
CCriticalSection cs_vNodes; CCriticalSection cs_vNodes;
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ); limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
static std::deque<std::string> vOneShots;
CCriticalSection cs_vOneShots;
std::vector<std::string> vAddedNodes; std::vector<std::string> vAddedNodes;
CCriticalSection cs_vAddedNodes; CCriticalSection cs_vAddedNodes;
@ -107,7 +104,7 @@ boost::condition_variable messageHandlerCondition;
static CNodeSignals g_signals; static CNodeSignals g_signals;
CNodeSignals& GetNodeSignals() { return g_signals; } CNodeSignals& GetNodeSignals() { return g_signals; }
void AddOneShot(const std::string& strDest) void CConnman::AddOneShot(const std::string& strDest)
{ {
LOCK(cs_vOneShots); LOCK(cs_vOneShots);
vOneShots.push_back(strDest); vOneShots.push_back(strDest);

View File

@ -87,7 +87,6 @@ unsigned int SendBufferSize();
typedef int NodeId; typedef int NodeId;
void AddOneShot(const std::string& strDest);
CNode* FindNode(const CNetAddr& ip); CNode* FindNode(const CNetAddr& ip);
CNode* FindNode(const CSubNet& subNet); CNode* FindNode(const CSubNet& subNet);
CNode* FindNode(const std::string& addrName); CNode* FindNode(const std::string& addrName);
@ -137,6 +136,7 @@ public:
void GetBanned(banmap_t &banmap); void GetBanned(banmap_t &banmap);
void SetBanned(const banmap_t &banmap); void SetBanned(const banmap_t &banmap);
void AddOneShot(const std::string& strDest);
private: private:
struct ListenSocket { struct ListenSocket {
SOCKET socket; SOCKET socket;
@ -171,6 +171,8 @@ private:
bool setBannedIsDirty; bool setBannedIsDirty;
bool fAddressesInitialized; bool fAddressesInitialized;
CAddrMan addrman; CAddrMan addrman;
std::deque<std::string> vOneShots;
CCriticalSection cs_vOneShots;
}; };
extern std::unique_ptr<CConnman> g_connman; extern std::unique_ptr<CConnman> g_connman;
void MapPort(bool fUseUPnP); void MapPort(bool fUseUPnP);