]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add id to async watchers to simplify debugging
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Mar 2017 11:39:54 +0000 (11:39 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 23 Mar 2017 11:40:18 +0000 (11:40 +0000)
src/libmime/filter.c
src/libserver/events.c
src/libserver/events.h
src/libserver/symbols_cache.c

index 1356cca20221c17a82189e03fc14a4efa511d644..c2eeecc32b526836a6df84e0c5c54b727311859f 100644 (file)
@@ -248,7 +248,7 @@ insert_metric_result (struct rspamd_task *task,
                g_hash_table_insert (metric_res->symbols, (gpointer) symbol, s);
        }
 
-       msg_debug ("symbol %s, score %.2f, metric %s, factor: %f",
+       msg_debug_task ("symbol %s, score %.2f, metric %s, factor: %f",
                symbol,
                s->score,
                metric->name,
index a5bd740ff2e970bce2a92104175953170305e324..8a3d0738d014d7a23dc55a0e002af7d022c27bd7 100644 (file)
@@ -43,8 +43,9 @@
 
 struct rspamd_async_watcher {
        event_watcher_t cb;
-       guint remain;
        gpointer ud;
+       guint remain;
+       gint id;
 };
 
 struct rspamd_async_event {
@@ -273,6 +274,7 @@ rspamd_session_pending (struct rspamd_async_session *session)
 
 void
 rspamd_session_watch_start (struct rspamd_async_session *session,
+               gint id,
                event_watcher_t cb,
                gpointer ud)
 {
@@ -287,6 +289,7 @@ rspamd_session_watch_start (struct rspamd_async_session *session,
        session->cur_watcher->cb = cb;
        session->cur_watcher->remain = 0;
        session->cur_watcher->ud = ud;
+       session->cur_watcher->id = id;
        session->flags |= RSPAMD_SESSION_FLAG_WATCHING;
 }
 
@@ -323,7 +326,8 @@ rspamd_session_events_pending (struct rspamd_async_session *session)
 
        if (RSPAMD_SESSION_IS_WATCHING (session)) {
                npending += session->cur_watcher->remain;
-               msg_debug_session ("pending %d watchers", session->cur_watcher->remain);
+               msg_debug_session ("pending %d watchers, id: %d",
+                               session->cur_watcher->remain, session->cur_watcher->id);
        }
 
        return npending;
@@ -336,7 +340,9 @@ rspamd_session_watcher_push (struct rspamd_async_session *session)
 
        if (RSPAMD_SESSION_IS_WATCHING (session)) {
                session->cur_watcher->remain ++;
-               msg_debug_session ("push session, %d events", session->cur_watcher->remain);
+               msg_debug_session ("push session, watcher: %d, %d events",
+                               session->cur_watcher->id,
+                               session->cur_watcher->remain);
        }
 }
 
@@ -348,6 +354,9 @@ rspamd_session_watcher_push_specific (struct rspamd_async_session *session,
 
        if (w) {
                w->remain ++;
+               msg_debug_session ("push specific, watcher: %d, %d events",
+                               w->id,
+                               w->remain);
        }
 }
 
@@ -358,7 +367,8 @@ rspamd_session_watcher_pop (struct rspamd_async_session *session,
        g_assert (session != NULL);
 
        if (w) {
-               msg_debug_session ("pop session, %d events", w->remain);
+               msg_debug_session ("pop session, watcher: %d, %d events", w->id,
+                               w->remain);
 
                if (--w->remain == 0) {
                        w->cb (session->user_data, w->ud);
index acfa11ebd6581fef9c695aa7857394d6c3f6d1a1..71854f205ce7ce281402574d69a43915e5bd7107 100644 (file)
@@ -93,6 +93,7 @@ guint rspamd_session_events_pending (struct rspamd_async_session *session);
  * @param ud opaque data for the callback
  */
 void rspamd_session_watch_start (struct rspamd_async_session *s,
+               gint id,
                event_watcher_t cb,
                gpointer ud);
 
index 6c0be35d46e1610cb71e27cc9e19de4eeccd7d7b..f0959a15e6ec2738fc061f5fb5f5d81f2d3f4cf0 100644 (file)
@@ -1288,7 +1288,9 @@ rspamd_symbols_cache_check_symbol (struct rspamd_task *task,
                if (check) {
                        pending_before = rspamd_session_events_pending (task->s);
                        /* Watch for events appeared */
-                       rspamd_session_watch_start (task->s, rspamd_symbols_cache_watcher_cb,
+                       rspamd_session_watch_start (task->s,
+                                       item->id,
+                                       rspamd_symbols_cache_watcher_cb,
                                        item);
                        msg_debug_task ("execute %s, %d", item->symbol, item->id);
                        t1 = rspamd_get_ticks ();