From 332574564b6549a24e2dce2dd55656df418ded58 Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 26 Feb 2016 22:13:59 +1100 Subject: [PATCH] ckdb - correct IPS removal and name the events trees --- src/ckdb.c | 8 ++++---- src/ckdb.h | 2 +- src/ckdb_data.c | 2 ++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index 30f423a4..260477d4 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -1259,10 +1259,10 @@ static void alloc_storage() events_free = k_new_list("Events", sizeof(EVENTS), ALLOC_EVENTS, LIMIT_EVENTS, true); events_store = k_new_store(events_free); - events_user_root = new_ktree(NULL, cmp_events_user, events_free); - events_ip_root = new_ktree(NULL, cmp_events_ip, events_free); - events_ipc_root = new_ktree(NULL, cmp_events_ipc, events_free); - events_hash_root = new_ktree(NULL, cmp_events_hash, events_free); + events_user_root = new_ktree("EventsUser", cmp_events_user, events_free); + events_ip_root = new_ktree("EventsIP", cmp_events_ip, events_free); + events_ipc_root = new_ktree("EventsIPC", cmp_events_ipc, events_free); + events_hash_root = new_ktree("EventsHash", cmp_events_hash, events_free); ovents_free = k_new_list("OKEvents", sizeof(OVENTS), ALLOC_OVENTS, LIMIT_OVENTS, true); diff --git a/src/ckdb.h b/src/ckdb.h index 4f76afdb..1c573aef 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -51,7 +51,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.4" -#define CKDB_VERSION DB_VERSION"-1.959" +#define CKDB_VERSION DB_VERSION"-1.960" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_data.c b/src/ckdb_data.c index 49336136..2e7cf855 100644 --- a/src/ckdb_data.c +++ b/src/ckdb_data.c @@ -4378,6 +4378,7 @@ bool _ok_ips(bool is_event, char *ip, char *eventname, tv_t *now) } // The OK has expired, so remove it prev_item = prev_in_ktree(ctx); + remove_from_ktree(ips_root, i_item); k_unlink_item(ips_store, i_item); if (ips->description) { LIST_MEM_SUB(ips_free, ips->description); @@ -4418,6 +4419,7 @@ bool banned_ips(char *ip, tv_t *now, bool *is_event) } // The ban has expired, so remove it prev_item = prev_in_ktree(ctx); + remove_from_ktree(ips_root, i_item); k_unlink_item(ips_store, i_item); if (ips->description) { LIST_MEM_SUB(ips_free, ips->description);