diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-09 19:07:32 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2013-01-09 19:07:32 +0400 |
commit | 3918004b4161414bf0471dd1691b8c25000d02e1 (patch) | |
tree | 1cf276f65b4582d6d7f54cf534244114fc1400a9 | |
parent | 366dcda9e75a6fdf658dc807dc2925f36e62ff08 (diff) | |
download | rspamd-3918004b4161414bf0471dd1691b8c25000d02e1.tar.gz rspamd-3918004b4161414bf0471dd1691b8c25000d02e1.zip |
Store weight of symbol properly allowing dynamic conf code to modify a single pointer in metrics section.
-rw-r--r-- | src/cfg_file.h | 2 | ||||
-rw-r--r-- | src/cfg_xml.c | 2 | ||||
-rw-r--r-- | src/webui.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/cfg_file.h b/src/cfg_file.h index e3e24759e..e87d10316 100644 --- a/src/cfg_file.h +++ b/src/cfg_file.h @@ -144,7 +144,7 @@ struct module_opt { struct symbol_def { gchar *name; gchar *description; - gdouble weight; + gdouble *weight_ptr; }; /** diff --git a/src/cfg_xml.c b/src/cfg_xml.c index b7e5a7ab9..ea42e1ae2 100644 --- a/src/cfg_xml.c +++ b/src/cfg_xml.c @@ -1097,7 +1097,7 @@ handle_metric_symbol (struct config_file *cfg, struct rspamd_xml_userdata *ctx, } } - sym_def->weight = *value; + sym_def->weight_ptr = value; sym_def->name = memory_pool_strdup (cfg->cfg_pool, data); if (attrs != NULL) { diff --git a/src/webui.c b/src/webui.c index c7f734512..a86f9abe6 100644 --- a/src/webui.c +++ b/src/webui.c @@ -589,11 +589,11 @@ http_handle_symbols (struct evhttp_request *req, gpointer arg) sym = cur_sym->data; if (sym->description) { - evbuffer_add_printf (evb, "{\"symbol\":\"%s\",\"weight\":%.2f,\"description\":\"%s\"%s", sym->name, sym->weight, + evbuffer_add_printf (evb, "{\"symbol\":\"%s\",\"weight\":%.2f,\"description\":\"%s\"%s", sym->name, *sym->weight_ptr, sym->description, g_list_next (cur_sym) ? "}," : "}"); } else { - evbuffer_add_printf (evb, "{\"symbol\":\"%s\",\"weight\":%.2f%s", sym->name, sym->weight, + evbuffer_add_printf (evb, "{\"symbol\":\"%s\",\"weight\":%.2f%s", sym->name, *sym->weight_ptr, g_list_next (cur_sym) ? "}," : "}"); } |