aboutsummaryrefslogtreecommitdiff
path: root/src/net_processing.cpp
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2017-10-04 18:25:34 -0400
committerCarl Dong <accounts@carldong.me>2019-01-16 11:04:05 -0500
commit7cc2b9f6786f9bc33853220551eed33ca6b7b7b2 (patch)
tree93ed4cf7b37c8994fefc4fb31eac75acea9f7329 /src/net_processing.cpp
parentf71c2ea6620a262dd97ba01bdd3dfb3e619cb8cb (diff)
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.
Diffstat (limited to 'src/net_processing.cpp')
-rw-r--r--src/net_processing.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index 0e222bdfa4..56cd52ed21 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2961,14 +2961,14 @@ static bool SendRejectsAndCheckIfBanned(CNode* pnode, CConnman* connman, bool en
LogPrintf("Warning: not punishing whitelisted peer %s!\n", pnode->addr.ToString());
else if (pnode->m_manual_connection)
LogPrintf("Warning: not punishing manually-connected peer %s!\n", pnode->addr.ToString());
- else {
+ else if (pnode->addr.IsLocal()) {
+ // Disconnect but don't ban _this_ local node
+ LogPrintf("Warning: disconnecting but not banning local peer %s!\n", pnode->addr.ToString());
pnode->fDisconnect = true;
- if (pnode->addr.IsLocal())
- LogPrintf("Warning: not banning local peer %s!\n", pnode->addr.ToString());
- else
- {
- connman->Ban(pnode->addr, BanReasonNodeMisbehaving);
- }
+ } else {
+ // Disconnect and ban all nodes sharing the address
+ connman->Ban(pnode->addr, BanReasonNodeMisbehaving);
+ connman->DisconnectNode(pnode->addr);
}
return true;
}