summaryrefslogtreecommitdiffstats
path: root/src/libserver/events.c
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/events.c
parentceb1547605fe8b9fb4eda214bf62267b9fb6e94f (diff)
downloadrspamd-a74882ea00280abccfe946ba31182337606f7a45.tar.gz
rspamd-a74882ea00280abccfe946ba31182337606f7a45.zip
[Minor] Add id to async watchers to simplify debugging
Diffstat (limited to 'src/libserver/events.c')
-rw-r--r--src/libserver/events.c18
1 files changed, 14 insertions, 4 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);