Browse Source

net: Add oneshot functions to CConnman

0.14
Cory Fields 9 years ago
parent
commit
502dd3a8a0
  1. 2
      src/init.cpp
  2. 5
      src/net.cpp
  3. 4
      src/net.h

2
src/init.cpp

@ -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);

5
src/net.cpp

@ -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);

4
src/net.h

@ -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);

Loading…
Cancel
Save