summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-08 18:26:25 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-08 18:26:25 -0700
commit31a999c10fe69916dec7e18db2b83fb04ff6a4eb (patch)
tree040efc26aecae866ab46b031616f799f163dee39
parentc3e9db5fa73ee6cad8bb1732c74b0a035baa9698 (diff)
downloadtxrban-31a999c10fe69916dec7e18db2b83fb04ff6a4eb.tar.gz
txrban-31a999c10fe69916dec7e18db2b83fb04ff6a4eb.tar.bz2
txrban-31a999c10fe69916dec7e18db2b83fb04ff6a4eb.zip
Purge inactive clients from hash in do-expiry.
-rw-r--r--txrban.txr6
1 files changed, 4 insertions, 2 deletions
diff --git a/txrban.txr b/txrban.txr
index f66f76e..355bacf 100644
--- a/txrban.txr
+++ b/txrban.txr
@@ -82,8 +82,10 @@
(defun do-expiry (now-time)
(dohash (ip cli client-hash)
- (if (and cli.banned (<= (to cli.banned) now-time))
- (unban cli))))
+ (when (and cli.banned (<= (to cli.banned) now-time))
+ (unban cli)
+ (when (null cli.access-hist)
+ (del [client-hash ip])))))
(defun unban (cli)
(unless *dry-run*