mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Move DisconnectNodes logic to private method.
This commit is contained in:
parent
edb5350c32
commit
7479b63d91
2 changed files with 64 additions and 61 deletions
42
src/net.cpp
42
src/net.cpp
|
@ -1153,27 +1153,8 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
|
|||
}
|
||||
}
|
||||
|
||||
void CConnman::NotifyNumConnectionsChanged()
|
||||
void CConnman::DisconnectNodes()
|
||||
{
|
||||
size_t vNodesSize;
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
vNodesSize = vNodes.size();
|
||||
}
|
||||
if(vNodesSize != nPrevNodeCount) {
|
||||
nPrevNodeCount = vNodesSize;
|
||||
if(clientInterface)
|
||||
clientInterface->NotifyNumConnectionsChanged(vNodesSize);
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::ThreadSocketHandler()
|
||||
{
|
||||
while (!interruptNet)
|
||||
{
|
||||
//
|
||||
// Disconnect nodes
|
||||
//
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
|
||||
|
@ -1232,6 +1213,27 @@ void CConnman::ThreadSocketHandler()
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::NotifyNumConnectionsChanged()
|
||||
{
|
||||
size_t vNodesSize;
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
vNodesSize = vNodes.size();
|
||||
}
|
||||
if(vNodesSize != nPrevNodeCount) {
|
||||
nPrevNodeCount = vNodesSize;
|
||||
if(clientInterface)
|
||||
clientInterface->NotifyNumConnectionsChanged(vNodesSize);
|
||||
}
|
||||
}
|
||||
|
||||
void CConnman::ThreadSocketHandler()
|
||||
{
|
||||
while (!interruptNet)
|
||||
{
|
||||
DisconnectNodes();
|
||||
NotifyNumConnectionsChanged();
|
||||
|
||||
//
|
||||
|
|
|
@ -336,6 +336,7 @@ private:
|
|||
void ThreadOpenConnections(std::vector<std::string> connect);
|
||||
void ThreadMessageHandler();
|
||||
void AcceptConnection(const ListenSocket& hListenSocket);
|
||||
void DisconnectNodes();
|
||||
void NotifyNumConnectionsChanged();
|
||||
void ThreadSocketHandler();
|
||||
void ThreadDNSAddressSeed();
|
||||
|
|
Loading…
Add table
Reference in a new issue