Cleanup logging, add stats for strlists.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 17 Oct 2008 20:50:23 +0000 (22:50 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 17 Oct 2008 20:50:23 +0000 (22:50 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
postlicyd/greylist.c
postlicyd/strlist.c

index 936f0e2..b2ea86c 100644 (file)
@@ -105,7 +105,6 @@ static TCBDB *greylist_db_get(const greylist_config_t *config,
         char tmppath[PATH_MAX];
         snprintf(tmppath, PATH_MAX, "%s.tmp", path);
 
         char tmppath[PATH_MAX];
         snprintf(tmppath, PATH_MAX, "%s.tmp", path);
 
-        info("database cleanup started");
         awl_db = tcbdbnew();
         if (tcbdbopen(awl_db, path, BDBOREADER)) {
             tmp_db = tcbdbnew();
         awl_db = tcbdbnew();
         if (tcbdbopen(awl_db, path, BDBOREADER)) {
             tmp_db = tcbdbnew();
index b66c33a..07b358e 100644 (file)
@@ -119,6 +119,7 @@ static trie_t *strlist_create(const char *file, bool reverse, bool lock)
     file_map_t map;
     const char *p, *end;
     char line[BUFSIZ];
     file_map_t map;
     const char *p, *end;
     char line[BUFSIZ];
+    uint32_t count = 0;
 
     if (!file_map_open(&map, file, false)) {
         return NULL;
 
     if (!file_map_open(&map, file, false)) {
         return NULL;
@@ -156,12 +157,14 @@ static trie_t *strlist_create(const char *file, bool reverse, bool lock)
             if (p < eos) {
                 strlist_copy(line, p, eos - p, reverse);
                 trie_insert(db, line);
             if (p < eos) {
                 strlist_copy(line, p, eos - p, reverse);
                 trie_insert(db, line);
+                ++count;
             }
         }
         p = eol + 1;
     }
     file_map_close(&map);
     trie_compile(db, lock);
             }
         }
         p = eol + 1;
     }
     file_map_close(&map);
     trie_compile(db, lock);
+    info("%s loaded, %u entries", file, count);
     return db;
 }
 
     return db;
 }
 
@@ -241,6 +244,7 @@ static bool strlist_create_from_rhbl(const char *file, bool lock,
         trie_delete(&domains);
         *pdomains = NULL;
     }
         trie_delete(&domains);
         *pdomains = NULL;
     }
+    info("rhbl %s loaded, %u hosts, %u domains", file, host_count, domain_count);
     return hosts != NULL || domains != NULL;
 
 }
     return hosts != NULL || domains != NULL;
 
 }