]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Count watchers as independent events
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Feb 2017 12:38:14 +0000 (12:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 7 Feb 2017 12:38:14 +0000 (12:38 +0000)
It might be important for better dependencies tracking.

src/libserver/events.c

index 2c8f9999c1e61b839e6e7340c1825e5e0dc84fa1..774e44f2bb7f3856224b7d1aa711bd9f03f81bbf 100644 (file)
@@ -306,11 +306,19 @@ rspamd_session_watch_stop (struct rspamd_async_session *s)
 
 
 guint
-rspamd_session_events_pending (struct rspamd_async_session *session)
+rspamd_session_events_pending (struct rspamd_async_session *s)
 {
-       g_assert (session != NULL);
+       guint npending;
 
-       return g_hash_table_size (session->events);
+       g_assert (s != NULL);
+
+       npending = g_hash_table_size (s->events);
+
+       if (RSPAMD_SESSION_IS_WATCHING (s)) {
+               npending += s->cur_watcher->remain;
+       }
+
+       return npending;
 }
 
 void