]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Add assertion to find bugs with events.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 May 2015 10:44:39 +0000 (11:44 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 26 May 2015 10:44:39 +0000 (11:44 +0100)
src/libserver/events.c

index 74559872cdcda2641accd8bf03f973dd39203736..a835872570e4ea37bda400072a66996d7496a129 100644 (file)
@@ -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);
 }