mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-09-01 18:40:40 +02:00
Move DisconnectNodes logic to private method.
This commit is contained in:
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);
|
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();
|
NotifyNumConnectionsChanged();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@@ -336,6 +336,7 @@ private:
|
|||||||
void ThreadOpenConnections(std::vector<std::string> connect);
|
void ThreadOpenConnections(std::vector<std::string> connect);
|
||||||
void ThreadMessageHandler();
|
void ThreadMessageHandler();
|
||||||
void AcceptConnection(const ListenSocket& hListenSocket);
|
void AcceptConnection(const ListenSocket& hListenSocket);
|
||||||
|
void DisconnectNodes();
|
||||||
void NotifyNumConnectionsChanged();
|
void NotifyNumConnectionsChanged();
|
||||||
void ThreadSocketHandler();
|
void ThreadSocketHandler();
|
||||||
void ThreadDNSAddressSeed();
|
void ThreadDNSAddressSeed();
|
||||||
|
Reference in New Issue
Block a user