mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
net: Break disconnecting out of Ban()
These are separate events which need to be carried out by separate subsystems. This also cleans up some whitespace and tabs in qt to avoid getting flagged by the linter. Current behavior is preserved.
This commit is contained in:
26
src/net.cpp
26
src/net.cpp
@@ -554,13 +554,6 @@ void CConnman::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t ba
|
||||
}
|
||||
if(clientInterface)
|
||||
clientInterface->BannedListChanged();
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
for (CNode* pnode : vNodes) {
|
||||
if (subNet.Match(static_cast<CNetAddr>(pnode->addr)))
|
||||
pnode->fDisconnect = true;
|
||||
}
|
||||
}
|
||||
if(banReason == BanReasonManuallyAdded)
|
||||
DumpBanlist(); //store banlist to disk immediately if user requested ban
|
||||
}
|
||||
@@ -2643,6 +2636,25 @@ bool CConnman::DisconnectNode(const std::string& strNode)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CConnman::DisconnectNode(const CSubNet& subnet)
|
||||
{
|
||||
bool disconnected = false;
|
||||
LOCK(cs_vNodes);
|
||||
for (CNode* pnode : vNodes) {
|
||||
if (subnet.Match(pnode->addr)) {
|
||||
pnode->fDisconnect = true;
|
||||
disconnected = true;
|
||||
}
|
||||
}
|
||||
return disconnected;
|
||||
}
|
||||
|
||||
bool CConnman::DisconnectNode(const CNetAddr& addr)
|
||||
{
|
||||
return DisconnectNode(CSubNet(addr));
|
||||
}
|
||||
|
||||
bool CConnman::DisconnectNode(NodeId id)
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
|
||||
Reference in New Issue
Block a user