diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-27 18:45:43 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-12-27 18:45:43 +0000 |
commit | d6b21b81428e45f009b1f42714342d68270cb8f9 (patch) | |
tree | 2fc040450593d0dd8d5dd646d4e480e8b27397b0 /src/libserver/async_session.c | |
parent | a941c5524852826f904f5f53e3867081cc7c36ec (diff) | |
download | rspamd-d6b21b81428e45f009b1f42714342d68270cb8f9.tar.gz rspamd-d6b21b81428e45f009b1f42714342d68270cb8f9.zip |
[Minor] Log events on forced timeout
Diffstat (limited to 'src/libserver/async_session.c')
-rw-r--r-- | src/libserver/async_session.c | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/src/libserver/async_session.c b/src/libserver/async_session.c index 057604447..f84b8aa5e 100644 --- a/src/libserver/async_session.c +++ b/src/libserver/async_session.c @@ -257,7 +257,7 @@ rspamd_session_destroy (struct rspamd_async_session *session) if (!rspamd_session_blocked (session)) { session->flags |= RSPAMD_SESSION_FLAG_DESTROYING; - rspamd_session_cleanup (session); + rspamd_session_cleanup (session, false); if (session->cleanup != NULL) { session->cleanup (session->user_data); @@ -268,7 +268,7 @@ rspamd_session_destroy (struct rspamd_async_session *session) } void -rspamd_session_cleanup (struct rspamd_async_session *session) +rspamd_session_cleanup (struct rspamd_async_session *session, bool forced_cleanup) { struct rspamd_async_event *ev; @@ -285,15 +285,32 @@ rspamd_session_cleanup (struct rspamd_async_session *session) int ret; if (ev->fin != NULL) { - msg_debug_session ("removed event on destroy: %p, subsystem: %s", - ev->user_data, - ev->subsystem); + if (forced_cleanup) { + msg_info_session ("forced removed event on destroy: %p, subsystem: %s, scheduled from: %s", + ev->user_data, + ev->subsystem, + ev->loc); + } + else { + msg_debug_session("removed event on destroy: %p, subsystem: %s", + ev->user_data, + ev->subsystem); + } ev->fin (ev->user_data); } else { - msg_debug_session ("NOT removed event on destroy - uncancellable: %p, subsystem: %s", - ev->user_data, - ev->subsystem); + if (forced_cleanup) { + msg_info_session ("NOT forced removed event on destroy - uncancellable: " + "%p, subsystem: %s, scheduled from: %s", + ev->user_data, + ev->subsystem, + ev->loc); + } + else { + msg_debug_session("NOT removed event on destroy - uncancellable: %p, subsystem: %s", + ev->user_data, + ev->subsystem); + } /* Assume an event is uncancellable, move it to a new hash table */ kh_put (rspamd_events_hash, uncancellable_events, ev, &ret); } @@ -301,7 +318,13 @@ rspamd_session_cleanup (struct rspamd_async_session *session) kh_destroy (rspamd_events_hash, session->events); session->events = uncancellable_events; - msg_debug_session ("pending %d uncancellable events", kh_size (uncancellable_events)); + if (forced_cleanup) { + msg_info_session ("pending %d uncancellable events", kh_size (uncancellable_events)); + } + else { + msg_debug_session ("pending %d uncancellable events", kh_size (uncancellable_events)); + } + session->flags &= ~RSPAMD_SESSION_FLAG_CLEANUP; } |