Merge pull request #1165

e57379a p2p: drop any existing connection to a banned IP (moneromooo-monero)
pull/95/head
Riccardo Spagni 8 years ago
commit e72b6a7ade
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

@ -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;
}

Loading…
Cancel
Save