mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
rpc: do not return bans if they're effectively spent
The blocked ip list will still hold them till next time a connection attempt is made with that IP, so the effective length of the ban may be negative.
This commit is contained in:
parent
474e4c00f0
commit
789e2755f7
1 changed files with 7 additions and 4 deletions
|
@ -950,14 +950,17 @@ namespace cryptonote
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto now = time(nullptr);
|
||||||
std::map<uint32_t, time_t> blocked_ips = m_p2p.get_blocked_ips();
|
std::map<uint32_t, time_t> blocked_ips = m_p2p.get_blocked_ips();
|
||||||
for (std::map<uint32_t, time_t>::const_iterator i = blocked_ips.begin(); i != blocked_ips.end(); ++i)
|
for (std::map<uint32_t, time_t>::const_iterator i = blocked_ips.begin(); i != blocked_ips.end(); ++i)
|
||||||
{
|
{
|
||||||
|
if (i->second > now) {
|
||||||
COMMAND_RPC_GETBANS::ban b;
|
COMMAND_RPC_GETBANS::ban b;
|
||||||
b.ip = i->first;
|
b.ip = i->first;
|
||||||
b.seconds = i->second;
|
b.seconds = i->second - now;
|
||||||
res.bans.push_back(b);
|
res.bans.push_back(b);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
res.status = CORE_RPC_STATUS_OK;
|
res.status = CORE_RPC_STATUS_OK;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue