some comments

This commit is contained in:
Lev Kokotov
2022-02-09 06:51:31 -08:00
parent 9fe50c48e8
commit 4c16ba3848
4 changed files with 20 additions and 9 deletions

View File

@@ -182,7 +182,7 @@ impl ConnectionPool {
pub fn is_banned(&self, address: &Address, shard: usize) -> bool {
let mut guard = self.banlist.lock().unwrap();
// Everything is banned, nothig is banned
// Everything is banned = nothing is banned.
if guard[shard].len() == self.databases[shard].len() {
guard[shard].clear();
drop(guard);
@@ -194,8 +194,8 @@ impl ConnectionPool {
match guard[shard].get(address) {
Some(timestamp) => {
let now = chrono::offset::Utc::now().naive_utc();
// Ban expired.
if now.timestamp() - timestamp.timestamp() > self.ban_time {
// 1 minute
guard[shard].remove(address);
false
} else {