]> source.dussan.org Git - rspamd.git/commitdiff
* Turn off debug_ip during reload if it was disabled by new config
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 26 Jul 2010 14:24:26 +0000 (18:24 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Mon, 26 Jul 2010 14:24:26 +0000 (18:24 +0400)
src/logger.c
src/lua/lua_common.c

index 55a7f0fe561fa25376153eaf6bc3f9cd92380b36..4b04a93f17a2965d0a0c1862105f59abbaa6974b 100644 (file)
@@ -246,6 +246,9 @@ rspamd_set_logger (enum rspamd_log_type type, enum process_type ptype, struct co
        /* Set up conditional logging */
        if (cfg->debug_ip_map != NULL) {
                /* Try to add it as map first of all */
+               if (rspamd_log->debug_ip) {
+                       radix_tree_free (rspamd_log->debug_ip);
+               }
                rspamd_log->debug_ip = radix_tree_create ();
                if (!add_map (cfg->debug_ip_map, read_radix_list, fin_radix_list, (void **)&rspamd_log->debug_ip)) {
                        /* Try to parse it as list */
@@ -277,6 +280,10 @@ rspamd_set_logger (enum rspamd_log_type type, enum process_type ptype, struct co
                        g_strfreev (strvec);
                }
        }
+       else if (rspamd_log->debug_ip) {
+               radix_tree_free (rspamd_log->debug_ip);
+               rspamd_log->debug_ip = NULL;
+       }
 }
 
 int
index 36ef2a422795d373306bfe476a5bd2ec2b05dca1..3bf81da555319aee2a6577e1f2138c5df748b474 100644 (file)
@@ -209,7 +209,6 @@ void
 init_lua_filters (struct config_file *cfg)
 {
        struct config_file            **pcfg;
-       gpointer                       *plogger;
        GList                          *cur, *tmp;
        struct script_module           *module;
     struct statfile                *st;
@@ -230,11 +229,6 @@ init_lua_filters (struct config_file *cfg)
                        lua_setclass (L, "rspamd{config}", -1);
                        *pcfg = cfg;
                        lua_setglobal (L, "rspamd_config");
-                       /* Initialize logger */
-                       plogger = lua_newuserdata (L, sizeof (gpointer));
-                       lua_setclass (L, "rspamd{logger}", -1);
-                       *plogger = NULL;
-                       lua_setglobal (L, "rspamd_log");
 
                        /* do the call (1 arguments, 1 result) */
                        if (lua_pcall (L, 0, LUA_MULTRET, 0) != 0) {