diff options
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/p2p/net_node.inl | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/src/p2p/CMakeLists.txt b/src/p2p/CMakeLists.txt index f59bc3189..b5b7d87ff 100644 --- a/src/p2p/CMakeLists.txt +++ b/src/p2p/CMakeLists.txt @@ -27,15 +27,15 @@ # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cmake_minimum_required (VERSION 2.6) -project (bitmonero CXX) +project (monero CXX) file(GLOB P2P *) source_group(p2p FILES ${P2P}) #add_library(p2p ${P2P}) -#bitmonero_private_headers(p2p ${P2P}) -bitmonero_add_library(p2p ${P2P}) +#monero_private_headers(p2p ${P2P}) +monero_add_library(p2p ${P2P}) target_link_libraries(p2p PUBLIC ${UPNP_LIBRARIES} diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index 9c1d8629d..04d73ba95 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -200,6 +200,18 @@ namespace nodetool { CRITICAL_REGION_LOCAL(m_blocked_ips_lock); m_blocked_ips[addr] = time(nullptr) + seconds; + + // drop any connection to that IP + while (!m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt) + { + if (cntxt.m_remote_ip == addr) + { + drop_connection(cntxt); + return false; + } + return true; + })); + LOG_PRINT_CYAN("IP " << epee::string_tools::get_ip_string_from_int32(addr) << " blocked.", LOG_LEVEL_0); return true; } |