aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/events.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-14 12:51:54 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-08-14 12:51:54 +0100
commit1af89c35663dd364c8d46523f0d71adc64f8bde4 (patch)
tree1a814dea5f5ce6045bd53f2e802dd3eb87123ca0 /src/libserver/events.c
parent0478b4ee28138a886f9b457bdba7f2897e151093 (diff)
downloadrspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.tar.gz
rspamd-1af89c35663dd364c8d46523f0d71adc64f8bde4.zip
[Fix] Add fail-safety for destroying sessions
Diffstat (limited to 'src/libserver/events.c')
-rw-r--r--src/libserver/events.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libserver/events.c b/src/libserver/events.c
index 9b0d049d4..f62005b96 100644
--- a/src/libserver/events.c
+++ b/src/libserver/events.c
@@ -172,6 +172,13 @@ rspamd_session_add_event (struct rspamd_async_session *session,
g_assert_not_reached ();
}
+ if (RSPAMD_SESSION_IS_DESTROYING (session)) {
+ msg_debug_session ("skip adding event subsystem: %s: session is destroying",
+ g_quark_to_string (subsystem));
+
+ return NULL;
+ }
+
new_event = rspamd_mempool_alloc (session->pool,
sizeof (struct rspamd_async_event));
new_event->fin = fin;
@@ -502,4 +509,12 @@ rspamd_session_mempool (struct rspamd_async_session *session)
g_assert (session != NULL);
return session->pool;
+}
+
+gboolean
+rspamd_session_is_destroying (struct rspamd_async_session *session)
+{
+ g_assert (session != NULL);
+
+ return RSPAMD_SESSION_IS_DESTROYING (session);
} \ No newline at end of file