summaryrefslogtreecommitdiffstats
path: root/src/libserver/events.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-26 11:44:39 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-26 11:44:39 +0100
commit7c24683890f578b68f6b605f9bfba4854b22e056 (patch)
treeb229c3a9386e2b85224b54f20eb5e7ccfa212679 /src/libserver/events.c
parent0cbb494df0edc3a0a4704c7d8488c5f6f978db8d (diff)
downloadrspamd-7c24683890f578b68f6b605f9bfba4854b22e056.tar.gz
rspamd-7c24683890f578b68f6b605f9bfba4854b22e056.zip
Add assertion to find bugs with events.
Diffstat (limited to 'src/libserver/events.c')
-rw-r--r--src/libserver/events.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/libserver/events.c b/src/libserver/events.c
index 74559872c..a83587257 100644
--- a/src/libserver/events.c
+++ b/src/libserver/events.c
@@ -160,27 +160,26 @@ remove_normal_event (struct rspamd_async_session *session,
/* Search for event */
search_ev.fin = fin;
search_ev.user_data = ud;
- if ((found_ev =
- g_hash_table_lookup (session->events, &search_ev)) != NULL) {
+ found_ev = g_hash_table_lookup (session->events, &search_ev);
+ g_assert (found_ev != NULL);
- msg_debug ("removed event: %p, subsystem: %s, pending %d events", ud,
+ msg_debug ("removed event: %p, subsystem: %s, pending %d events", ud,
g_quark_to_string (found_ev->subsystem),
g_hash_table_size (session->events));
- /* Remove event */
- fin (ud);
-
- /* Call watcher if needed */
- if (found_ev->w) {
- if (found_ev->w->remain > 0) {
- if (--found_ev->w->remain == 0) {
- found_ev->w->cb (found_ev->w->ud);
- }
+ /* Remove event */
+ fin (ud);
+
+ /* Call watcher if needed */
+ if (found_ev->w) {
+ if (found_ev->w->remain > 0) {
+ if (--found_ev->w->remain == 0) {
+ found_ev->w->cb (found_ev->w->ud);
}
}
-
- g_hash_table_remove (session->events, found_ev);
}
+ g_hash_table_remove (session->events, found_ev);
+
check_session_pending (session);
}