From: Vsevolod Stakhov Date: Tue, 7 Feb 2017 12:38:14 +0000 (+0000) Subject: [Minor] Count watchers as independent events X-Git-Tag: 1.5.0~164 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e453052cd29a379d5783130344de9438cfe0ed79;p=rspamd.git [Minor] Count watchers as independent events It might be important for better dependencies tracking. --- diff --git a/src/libserver/events.c b/src/libserver/events.c index 2c8f9999c..774e44f2b 100644 --- a/src/libserver/events.c +++ b/src/libserver/events.c @@ -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