mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
p2p: only log to global when a blocked IP is not already blocked
This commit is contained in:
parent
8fef32e45c
commit
fe6dda9453
@ -234,6 +234,7 @@ namespace nodetool
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const time_t now = time(nullptr);
|
const time_t now = time(nullptr);
|
||||||
|
bool added = false;
|
||||||
|
|
||||||
CRITICAL_REGION_LOCAL(m_blocked_hosts_lock);
|
CRITICAL_REGION_LOCAL(m_blocked_hosts_lock);
|
||||||
time_t limit;
|
time_t limit;
|
||||||
@ -244,7 +245,10 @@ namespace nodetool
|
|||||||
const std::string host_str = addr.host_str();
|
const std::string host_str = addr.host_str();
|
||||||
auto it = m_blocked_hosts.find(host_str);
|
auto it = m_blocked_hosts.find(host_str);
|
||||||
if (it == m_blocked_hosts.end())
|
if (it == m_blocked_hosts.end())
|
||||||
|
{
|
||||||
m_blocked_hosts[host_str] = limit;
|
m_blocked_hosts[host_str] = limit;
|
||||||
|
added = true;
|
||||||
|
}
|
||||||
else if (it->second < limit || !add_only)
|
else if (it->second < limit || !add_only)
|
||||||
it->second = limit;
|
it->second = limit;
|
||||||
|
|
||||||
@ -275,7 +279,10 @@ namespace nodetool
|
|||||||
conns.clear();
|
conns.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (added)
|
||||||
MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked.");
|
MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked.");
|
||||||
|
else
|
||||||
|
MINFO("Host " << host_str << " block time updated.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user