mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Move NotifyNumConnectionsChanged logic to private method.
This commit is contained in:
parent
f9bf204829
commit
6eef194443
27
src/net.cpp
27
src/net.cpp
@ -1228,9 +1228,22 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::NotifyNumConnectionsChanged()
|
||||
{
|
||||
size_t vNodesSize;
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
vNodesSize = vNodes.size();
|
||||
}
|
||||
if(vNodesSize != nPrevNodeCount) {
|
||||
nPrevNodeCount = vNodesSize;
|
||||
if(clientInterface)
|
||||
clientInterface->NotifyNumConnectionsChanged(nPrevNodeCount);
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::ThreadSocketHandler()
|
||||
{
|
||||
unsigned int nPrevNodeCount = 0;
|
||||
while (!interruptNet)
|
||||
{
|
||||
//
|
||||
@ -1297,16 +1310,7 @@ void CConnman::ThreadSocketHandler()
|
||||
}
|
||||
}
|
||||
}
|
||||
size_t vNodesSize;
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
vNodesSize = vNodes.size();
|
||||
}
|
||||
if(vNodesSize != nPrevNodeCount) {
|
||||
nPrevNodeCount = vNodesSize;
|
||||
if(clientInterface)
|
||||
clientInterface->NotifyNumConnectionsChanged(nPrevNodeCount);
|
||||
}
|
||||
NotifyNumConnectionsChanged();
|
||||
|
||||
//
|
||||
// Find which sockets have data to receive
|
||||
@ -2506,6 +2510,7 @@ CConnman::CConnman(uint64_t nSeed0In, uint64_t nSeed1In) :
|
||||
setBannedIsDirty = false;
|
||||
fAddressesInitialized = false;
|
||||
nLastNodeId = 0;
|
||||
nPrevNodeCount = 0;
|
||||
nSendBufferMaxSize = 0;
|
||||
nReceiveFloodSize = 0;
|
||||
flagInterruptMsgProc = false;
|
||||
|
@ -474,6 +474,7 @@ private:
|
||||
void ThreadOpenConnections(std::vector<std::string> connect);
|
||||
void ThreadMessageHandler();
|
||||
void AcceptConnection(const ListenSocket& hListenSocket);
|
||||
void NotifyNumConnectionsChanged();
|
||||
void ThreadSocketHandler();
|
||||
void ThreadDNSAddressSeed();
|
||||
void ThreadOpenMasternodeConnections();
|
||||
@ -549,6 +550,7 @@ private:
|
||||
std::list<CNode*> vNodesDisconnected;
|
||||
mutable CCriticalSection cs_vNodes;
|
||||
std::atomic<NodeId> nLastNodeId;
|
||||
unsigned int nPrevNodeCount;
|
||||
|
||||
/** Services this instance offers */
|
||||
ServiceFlags nLocalServices;
|
||||
|
Loading…
Reference in New Issue
Block a user