mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 13:23:29 +01:00
Merge pull request #1396
7c0dd5e4
net_node: drop connections from banned IPs after looping through connections (moneromooo-monero)
This commit is contained in:
commit
4a0be41dfe
@ -203,15 +203,17 @@ namespace nodetool
|
|||||||
m_blocked_ips[addr] = time(nullptr) + seconds;
|
m_blocked_ips[addr] = time(nullptr) + seconds;
|
||||||
|
|
||||||
// drop any connection to that IP
|
// drop any connection to that IP
|
||||||
while (!m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
|
std::list<boost::uuids::uuid> conns;
|
||||||
|
m_net_server.get_config_object().foreach_connection([&](const p2p_connection_context& cntxt)
|
||||||
{
|
{
|
||||||
if (cntxt.m_remote_ip == addr)
|
if (cntxt.m_remote_ip == addr)
|
||||||
{
|
{
|
||||||
drop_connection(cntxt);
|
conns.push_back(cntxt.m_connection_id);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}));
|
});
|
||||||
|
for (const auto &c: conns)
|
||||||
|
m_net_server.get_config_object().close(c);
|
||||||
|
|
||||||
LOG_PRINT_CYAN("IP " << epee::string_tools::get_ip_string_from_int32(addr) << " blocked.", LOG_LEVEL_0);
|
LOG_PRINT_CYAN("IP " << epee::string_tools::get_ip_string_from_int32(addr) << " blocked.", LOG_LEVEL_0);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user