diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-12 18:31:47 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-17 21:40:55 +0200 |
commit | 4e36e9bcc7d071bba4c45fd89c0cfd2e2361ffe3 (patch) | |
tree | 2703eacb4f5dd62e6d6bb95193412cbcbf0e8ad5 /src/net.cpp | |
parent | 3de24d7647db2b9167cee25549c3c603582e19e6 (diff) |
setban: rewrite to UniValue, allow absolute bantime
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/net.cpp b/src/net.cpp index 3ba2379ea0..6b8a0a2b1e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -484,15 +484,15 @@ bool CNode::IsBanned(CSubNet subnet) return fResult; } -void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset) { +void CNode::Ban(const CNetAddr& addr, int64_t bantimeoffset, bool sinceUnixEpoch) { CSubNet subNet(addr.ToString()+(addr.IsIPv4() ? "/32" : "/128")); - Ban(subNet, bantimeoffset); + Ban(subNet, bantimeoffset, sinceUnixEpoch); } -void CNode::Ban(const CSubNet& subNet, int64_t bantimeoffset) { +void CNode::Ban(const CSubNet& subNet, int64_t bantimeoffset, bool sinceUnixEpoch) { int64_t banTime = GetTime()+GetArg("-bantime", 60*60*24); // Default 24-hour ban if (bantimeoffset > 0) - banTime = GetTime()+bantimeoffset; + banTime = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset; LOCK(cs_setBanned); if (setBanned[subNet] < banTime) |