aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/rspamd_control.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-14 17:00:26 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-12-14 17:00:26 +0000
commit8a9b8c7a86aa5531ac2119f95a30aa679882a07d (patch)
tree0c4bb90667d9b167d66ee448c66b007947b49605 /src/libserver/rspamd_control.c
parent49f060ff5ad7947f2625df8e7c1b944b2f0457a0 (diff)
downloadrspamd-8a9b8c7a86aa5531ac2119f95a30aa679882a07d.tar.gz
rspamd-8a9b8c7a86aa5531ac2119f95a30aa679882a07d.zip
Some fixes to fuzzystat
Diffstat (limited to 'src/libserver/rspamd_control.c')
-rw-r--r--src/libserver/rspamd_control.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index 90f1c27b6..cd6b7829b 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -185,6 +185,12 @@ rspamd_control_write_reply (struct rspamd_control_session *session)
workers = ucl_object_typed_new (UCL_OBJECT);
DL_FOREACH (session->replies, elt) {
+ /* Skip incompatible worker for fuzzy_stat */
+ if (session->cmd.type == RSPAMD_CONTROL_FUZZY_STAT &&
+ elt->wrk->type != g_quark_from_static_string ("fuzzy")) {
+ continue;
+ }
+
rspamd_snprintf (tmpbuf, sizeof (tmpbuf), "%P", elt->wrk->pid);
cur = ucl_object_typed_new (UCL_OBJECT);
@@ -226,8 +232,12 @@ rspamd_control_write_reply (struct rspamd_control_session *session)
if (elt->attached_fd != -1) {
/* We have some data to parse */
parser = ucl_parser_new (0);
- ucl_object_insert_key (cur, ucl_object_fromint (
- elt->reply.reply.fuzzy_stat.status), "status", 0, false);
+ ucl_object_insert_key (cur,
+ ucl_object_fromint (
+ elt->reply.reply.fuzzy_stat.status),
+ "status",
+ 0,
+ false);
if (ucl_parser_add_fd (parser, elt->attached_fd)) {
ucl_object_insert_key (cur, ucl_parser_get_object (parser),
@@ -235,12 +245,26 @@ rspamd_control_write_reply (struct rspamd_control_session *session)
ucl_parser_free (parser);
}
else {
+
ucl_object_insert_key (cur, ucl_object_fromstring (
ucl_parser_get_error (parser)), "error", 0, false);
ucl_parser_free (parser);
}
}
+ else {
+ ucl_object_insert_key (cur,
+ ucl_object_fromstring ("missing file"),
+ "error",
+ 0,
+ false);
+ ucl_object_insert_key (cur,
+ ucl_object_fromint (
+ elt->reply.reply.fuzzy_stat.status),
+ "status",
+ 0,
+ false);
+ }
break;
default:
break;