diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-26 00:04:22 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-11-26 00:04:22 +0000 |
commit | 38ceb73848a3c37df60bce637d855b7564b09730 (patch) | |
tree | ed35b91ab9e9b6a90e612cfe1ad42d54ce1d5321 /src/p2p/net_node.inl | |
parent | net_node: allow bans for custom amounts of time (diff) | |
download | monero-38ceb73848a3c37df60bce637d855b7564b09730.tar.xz |
add RPC calls and commands to get/set bans
Diffstat (limited to '')
-rw-r--r-- | src/p2p/net_node.inl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index f15e60201..067f6378d 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -186,7 +186,7 @@ namespace nodetool } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> - bool node_server<t_payload_net_handler>::block_ip(uint32_t addr, uint32_t seconds) + bool node_server<t_payload_net_handler>::block_ip(uint32_t addr, time_t seconds) { CRITICAL_REGION_LOCAL(m_blocked_ips_lock); m_blocked_ips[addr] = time(nullptr) + seconds; @@ -195,6 +195,18 @@ namespace nodetool } //----------------------------------------------------------------------------------- template<class t_payload_net_handler> + bool node_server<t_payload_net_handler>::unblock_ip(uint32_t addr) + { + CRITICAL_REGION_LOCAL(m_blocked_ips_lock); + auto i = m_blocked_ips.find(addr); + if (i == m_blocked_ips.end()) + return false; + m_blocked_ips.erase(i); + LOG_PRINT_CYAN("IP " << epee::string_tools::get_ip_string_from_int32(addr) << " unblocked.", LOG_LEVEL_0); + return true; + } + //----------------------------------------------------------------------------------- + template<class t_payload_net_handler> bool node_server<t_payload_net_handler>::add_ip_fail(uint32_t address) { CRITICAL_REGION_LOCAL(m_ip_fails_score_lock); |