mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Merge #9289: net: drop boost::thread_group
67ee4ecnet: misc header cleanups (Cory Fields)8b3159enet: make proxy receives interruptible (Cory Fields)5cb0fcenet: remove thread_interrupted catch (Cory Fields)d3d7056net: make net processing interruptible (Cory Fields)0985052net: make net interruptible (Cory Fields)799df91net: add CThreadInterrupt and InterruptibleSleep (Cory Fields)7325b15net: a few small cleanups before replacing boost threads (Cory Fields)
This commit is contained in:
23
src/net.h
23
src/net.h
@@ -19,11 +19,14 @@
|
||||
#include "streams.h"
|
||||
#include "sync.h"
|
||||
#include "uint256.h"
|
||||
#include "threadinterrupt.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <deque>
|
||||
#include <stdint.h>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <condition_variable>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <arpa/inet.h>
|
||||
@@ -142,8 +145,9 @@ public:
|
||||
};
|
||||
CConnman(uint64_t seed0, uint64_t seed1);
|
||||
~CConnman();
|
||||
bool Start(boost::thread_group& threadGroup, CScheduler& scheduler, std::string& strNodeError, Options options);
|
||||
bool Start(CScheduler& scheduler, std::string& strNodeError, Options options);
|
||||
void Stop();
|
||||
void Interrupt();
|
||||
bool BindListenPort(const CService &bindAddr, std::string& strError, bool fWhitelisted = false);
|
||||
bool GetNetworkActive() const { return fNetworkActive; };
|
||||
void SetNetworkActive(bool active);
|
||||
@@ -402,7 +406,6 @@ private:
|
||||
std::list<CNode*> vNodesDisconnected;
|
||||
mutable CCriticalSection cs_vNodes;
|
||||
std::atomic<NodeId> nLastNodeId;
|
||||
boost::condition_variable messageHandlerCondition;
|
||||
|
||||
/** Services this instance offers */
|
||||
ServiceFlags nLocalServices;
|
||||
@@ -419,6 +422,18 @@ private:
|
||||
|
||||
/** SipHasher seeds for deterministic randomness */
|
||||
const uint64_t nSeed0, nSeed1;
|
||||
|
||||
std::condition_variable condMsgProc;
|
||||
std::mutex mutexMsgProc;
|
||||
std::atomic<bool> flagInterruptMsgProc;
|
||||
|
||||
CThreadInterrupt interruptNet;
|
||||
|
||||
std::thread threadDNSAddressSeed;
|
||||
std::thread threadSocketHandler;
|
||||
std::thread threadOpenAddedConnections;
|
||||
std::thread threadOpenConnections;
|
||||
std::thread threadMessageHandler;
|
||||
};
|
||||
extern std::unique_ptr<CConnman> g_connman;
|
||||
void Discover(boost::thread_group& threadGroup);
|
||||
@@ -445,8 +460,8 @@ struct CombinerAll
|
||||
// Signals for message handling
|
||||
struct CNodeSignals
|
||||
{
|
||||
boost::signals2::signal<bool (CNode*, CConnman&), CombinerAll> ProcessMessages;
|
||||
boost::signals2::signal<bool (CNode*, CConnman&), CombinerAll> SendMessages;
|
||||
boost::signals2::signal<bool (CNode*, CConnman&, std::atomic<bool>&), CombinerAll> ProcessMessages;
|
||||
boost::signals2::signal<bool (CNode*, CConnman&, std::atomic<bool>&), CombinerAll> SendMessages;
|
||||
boost::signals2::signal<void (CNode*, CConnman&)> InitializeNode;
|
||||
boost::signals2::signal<void (NodeId, bool&)> FinalizeNode;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user