aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-23 11:39:54 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-23 11:40:18 +0000
commita74882ea00280abccfe946ba31182337606f7a45 (patch)
treea20a12bd004804e3ec429637ecd370e63fa440c1 /src/libserver
parentceb1547605fe8b9fb4eda214bf62267b9fb6e94f (diff)
downloadrspamd-a74882ea00280abccfe946ba31182337606f7a45.tar.gz
rspamd-a74882ea00280abccfe946ba31182337606f7a45.zip
[Minor] Add id to async watchers to simplify debugging
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/events.c18
-rw-r--r--src/libserver/events.h1
-rw-r--r--src/libserver/symbols_cache.c4
3 files changed, 18 insertions, 5 deletions
diff --git a/src/libserver/events.c b/src/libserver/events.c
index a5bd740ff..8a3d0738d 100644
--- a/src/libserver/events.c
+++ b/src/libserver/events.c
@@ -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);
diff --git a/src/libserver/events.h b/src/libserver/events.h
index acfa11ebd..71854f205 100644
--- a/src/libserver/events.h
+++ b/src/libserver/events.h
@@ -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);
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index 6c0be35d4..f0959a15e 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -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 ();