aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
authorCory Fields <cory-nospam-@coryfields.com>2016-04-16 17:43:11 -0400
committerCory Fields <cory-nospam-@coryfields.com>2016-09-08 12:12:57 -0400
commita0f3d3cdad630103d919a4ec802c413b87fa1f1a (patch)
treeb02339d74322cb6e6243a4b1bba743a374f4f439 /src/qt
parentaaf018e3b79417ecfd39291a8c100df77969d77a (diff)
net: move ban and addrman functions into CConnman
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bantablemodel.cpp3
-rw-r--r--src/qt/rpcconsole.cpp29
2 files changed, 15 insertions, 17 deletions
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
index d95106b5ac..6e11e23904 100644
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -48,7 +48,8 @@ public:
void refreshBanlist()
{
banmap_t banMap;
- CNode::GetBanned(banMap);
+ if(g_connman)
+ g_connman->GetBanned(banMap);
cachedBanlist.clear();
#if QT_VERSION >= 0x040700
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index e5720dd70e..708be6b646 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -887,26 +887,23 @@ void RPCConsole::disconnectSelectedNode()
void RPCConsole::banSelectedNode(int bantime)
{
- if (!clientModel)
+ if (!clientModel || !g_connman)
return;
// Get currently selected peer address
QString strNode = GUIUtil::getEntryData(ui->peerWidget, 0, PeerTableModel::Address).toString();
// Find possible nodes, ban it and clear the selected node
- if (FindNode(strNode.toStdString())) {
- std::string nStr = strNode.toStdString();
- std::string addr;
- int port = 0;
- SplitHostPort(nStr, port, addr);
-
- CNetAddr resolved;
- if(!LookupHost(addr.c_str(), resolved, false))
- return;
- CNode::Ban(resolved, BanReasonManuallyAdded, bantime);
+ std::string nStr = strNode.toStdString();
+ std::string addr;
+ int port = 0;
+ SplitHostPort(nStr, port, addr);
- clearSelectedNode();
- clientModel->getBanTableModel()->refresh();
- }
+ CNetAddr resolved;
+ if(!LookupHost(addr.c_str(), resolved, false))
+ return;
+ g_connman->Ban(resolved, BanReasonManuallyAdded, bantime);
+ clearSelectedNode();
+ clientModel->getBanTableModel()->refresh();
}
void RPCConsole::unbanSelectedNode()
@@ -919,9 +916,9 @@ void RPCConsole::unbanSelectedNode()
CSubNet possibleSubnet;
LookupSubNet(strNode.toStdString().c_str(), possibleSubnet);
- if (possibleSubnet.IsValid())
+ if (possibleSubnet.IsValid() && g_connman)
{
- CNode::Unban(possibleSubnet);
+ g_connman->Unban(possibleSubnet);
clientModel->getBanTableModel()->refresh();
}
}