diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2021-01-01 19:54:18 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2021-01-01 19:54:51 +0000 |
commit | c5c278c3392a38903398e7d9eda7dbc3900940d3 (patch) | |
tree | fa12bd88c5af54bbd0633c78f06e9b19952c6a67 /src/p2p/net_node.inl | |
parent | Merge pull request #7221 (diff) | |
download | monero-c5c278c3392a38903398e7d9eda7dbc3900940d3.tar.xz |
p2p: only log to global when a blocked IP is not already blocked
Diffstat (limited to '')
-rw-r--r-- | src/p2p/net_node.inl | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index bf053f0f2..e99c8a090 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -234,6 +234,7 @@ namespace nodetool return false; const time_t now = time(nullptr); + bool added = false; CRITICAL_REGION_LOCAL(m_blocked_hosts_lock); time_t limit; @@ -244,7 +245,10 @@ namespace nodetool const std::string host_str = addr.host_str(); auto it = m_blocked_hosts.find(host_str); if (it == m_blocked_hosts.end()) + { m_blocked_hosts[host_str] = limit; + added = true; + } else if (it->second < limit || !add_only) it->second = limit; @@ -275,7 +279,10 @@ namespace nodetool conns.clear(); } - MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked."); + if (added) + MCLOG_CYAN(el::Level::Info, "global", "Host " << host_str << " blocked."); + else + MINFO("Host " << host_str << " block time updated."); return true; } //----------------------------------------------------------------------------------- |