comparing the wrong time here

This commit is contained in:
Stefan Midjich 2017-11-17 23:54:34 +01:00
parent 64586005a7
commit bc0a9b851a

View file

@ -165,7 +165,7 @@ if args.refresh:
# Also do a purge of clients that have no traffic for 24 hrs # Also do a purge of clients that have no traffic for 24 hrs
if client.last_activity: if client.last_activity:
time_diff = client.last_activity-client.created time_diff = current_date-client.last_activity
if client.last_packets >= int(packets_val) and time_diff.days >= 1: if client.last_packets >= int(packets_val) and time_diff.days >= 1:
client.enabled = False client.enabled = False
@ -174,6 +174,10 @@ if args.refresh:
ip=client.ip_address ip=client.ip_address
)) ))
client.commit() client.commit()
else:
if not client.enabled:
client.enabled = True
client.commit()
for src_ip in args.src_ip: for src_ip in args.src_ip:
# Get client by IP or create a new one. # Get client by IP or create a new one.