Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/net.cpp
Show First 20 Lines • Show All 679 Lines • ▼ Show 20 Lines | if (strCommand == "add") { | ||||
banTime = request.params[2].get_int64(); | banTime = request.params[2].get_int64(); | ||||
} | } | ||||
bool absolute = false; | bool absolute = false; | ||||
if (request.params.size() == 4 && request.params[3].isTrue()) { | if (request.params.size() == 4 && request.params[3].isTrue()) { | ||||
absolute = true; | absolute = true; | ||||
} | } | ||||
isSubnet | if (isSubnet) { | ||||
? g_connman->Ban(subNet, BanReasonManuallyAdded, banTime, absolute) | g_connman->Ban(subNet, BanReasonManuallyAdded, banTime, absolute); | ||||
: g_connman->Ban(netAddr, BanReasonManuallyAdded, banTime, | g_connman->DisconnectNode(subNet); | ||||
absolute); | } else { | ||||
g_connman->Ban(netAddr, BanReasonManuallyAdded, banTime, absolute); | |||||
g_connman->DisconnectNode(netAddr); | |||||
} | |||||
} else if (strCommand == "remove") { | } else if (strCommand == "remove") { | ||||
if (!(isSubnet ? g_connman->Unban(subNet) | if (!(isSubnet ? g_connman->Unban(subNet) | ||||
: g_connman->Unban(netAddr))) { | : g_connman->Unban(netAddr))) { | ||||
throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, | throw JSONRPCError(RPC_CLIENT_INVALID_IP_OR_SUBNET, | ||||
"Error: Unban failed. Requested address/subnet " | "Error: Unban failed. Requested address/subnet " | ||||
"was not previously banned."); | "was not previously banned."); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |