diff options
-rw-r--r-- | src/libserver/events.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libserver/events.c b/src/libserver/events.c index 44a5d9191..2c8f9999c 100644 --- a/src/libserver/events.c +++ b/src/libserver/events.c @@ -217,11 +217,13 @@ rspamd_session_destroy (struct rspamd_async_session *session) return FALSE; } - session->flags |= RSPAMD_SESSION_FLAG_DESTROYING; - rspamd_session_cleanup (session); + if (!(session->flags & RSPAMD_SESSION_FLAG_DESTROYING)) { + session->flags |= RSPAMD_SESSION_FLAG_DESTROYING; + rspamd_session_cleanup (session); - if (session->cleanup != NULL) { - session->cleanup (session->user_data); + if (session->cleanup != NULL) { + session->cleanup (session->user_data); + } } return TRUE; |