]> source.dussan.org Git - rspamd.git/commitdiff
Show storage id in fuzzy stat command
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 16 Dec 2015 15:30:55 +0000 (15:30 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 16 Dec 2015 15:30:55 +0000 (15:30 +0000)
src/fuzzy_storage.c
src/libserver/rspamd_control.c
src/libserver/rspamd_control.h

index bd9337a5419cac6e5eeaa5d78dfa8b7cd03f099a..c6b2a3be07e4eb6511fe60ac730835fec38aae2d 100644 (file)
@@ -26,6 +26,7 @@
  * Rspamd fuzzy storage server
  */
 
+#include <libserver/rspamd_control.h>
 #include "config.h"
 #include "util.h"
 #include "rspamd.h"
@@ -856,6 +857,10 @@ rspamd_fuzzy_storage_stat (struct rspamd_main *rspamd_main,
        else {
                rep.reply.fuzzy_stat.status = 0;
 
+               memcpy (rep.reply.fuzzy_stat.storage_id,
+                               rspamd_fuzzy_backend_id (ctx->backend),
+                               sizeof (rep.reply.fuzzy_stat.storage_id));
+
                /* Iterate over all keys */
                obj = ucl_object_typed_new (UCL_OBJECT);
                g_hash_table_iter_init (&it, ctx->keys);
index df9746abfaedb03127cb87ed9a2a50a545926ff3..2aab37b584e3fbed503c1212f1ea16cc1596d29c 100644 (file)
@@ -251,6 +251,14 @@ rspamd_control_write_reply (struct rspamd_control_session *session)
 
                                        ucl_parser_free (parser);
                                }
+
+                               ucl_object_insert_key (cur,
+                                               ucl_object_fromlstring (
+                                                               elt->reply.reply.fuzzy_stat.storage_id,
+                                                               MEMPOOL_UID_LEN - 1),
+                                               "id",
+                                               0,
+                                               false);
                        }
                        else {
                                ucl_object_insert_key (cur,
index 2f864fd5aa00b77de90a66bae452d4033b7e9c2d..a15ace0d649c26be315e5076554a1693ad9ae039 100644 (file)
@@ -26,6 +26,7 @@
 #define RSPAMD_RSPAMD_CONTROL_H
 
 #include "config.h"
+#include "mem_pool.h"
 #include <event.h>
 
 struct rspamd_main;
@@ -94,6 +95,7 @@ struct rspamd_control_reply {
                } hs_loaded;
                struct {
                        guint status;
+                       gchar storage_id[MEMPOOL_UID_LEN];
                } fuzzy_stat;
        } reply;
 };