From 3deecad150f2ec11679cb85265c55df948e7c2bc Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 28 Dec 2021 20:15:50 +0000 Subject: [PATCH] [Minor] Slightly improve session events logging --- src/lua/lua_http.c | 14 ++++++++++---- src/lua/lua_tcp.c | 8 +++++++- src/lua/lua_udp.c | 10 ++++++++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index e4a3bedb1..ce2a48d63 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -389,7 +389,6 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) { rspamd_inet_address_set_port (cbd->addr, cbd->msg->port); unsigned http_opts = RSPAMD_HTTP_CLIENT_SIMPLE; - struct rspamd_http_message *msg = cbd->msg; if (cbd->msg->flags & RSPAMD_HTTP_FLAG_WANT_SSL) { http_opts |= RSPAMD_HTTP_CLIENT_SSL; @@ -440,9 +439,16 @@ lua_http_make_connection (struct lua_http_cbdata *cbd) } if (cbd->session) { - rspamd_session_add_event (cbd->session, - (event_finalizer_t) lua_http_fin, cbd, - M); + if (cbd->item) { + rspamd_session_add_event_full (cbd->session, + (event_finalizer_t) lua_http_fin, cbd, + M, rspamd_symcache_item_name (cbd->item)); + } + else { + rspamd_session_add_event (cbd->session, + (event_finalizer_t) lua_http_fin, cbd, + M); + } cbd->flags |= RSPAMD_LUA_HTTP_FLAG_RESOLVED; } diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index f15e25399..37f535850 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -1231,7 +1231,13 @@ lua_tcp_register_event (struct lua_tcp_cbdata *cbd) if (cbd->session) { event_finalizer_t fin = IS_SYNC (cbd) ? lua_tcp_void_finalyser : lua_tcp_fin; - cbd->async_ev = rspamd_session_add_event (cbd->session, fin, cbd, M); + if (cbd->item) { + cbd->async_ev = rspamd_session_add_event_full (cbd->session, fin, cbd, M, + rspamd_symcache_item_name (cbd->item)); + } + else { + cbd->async_ev = rspamd_session_add_event (cbd->session, fin, cbd, M); + } if (!cbd->async_ev) { return FALSE; diff --git a/src/lua/lua_udp.c b/src/lua/lua_udp.c index 5d1fd8c62..656d80349 100644 --- a/src/lua/lua_udp.c +++ b/src/lua/lua_udp.c @@ -236,8 +236,14 @@ static gboolean lua_udp_maybe_register_event (struct lua_udp_cbdata *cbd) { if (cbd->s && !cbd->async_ev) { - cbd->async_ev = rspamd_session_add_event (cbd->s, lua_udp_cbd_fin, - cbd, M); + if (cbd->item) { + cbd->async_ev = rspamd_session_add_event_full (cbd->s, lua_udp_cbd_fin, + cbd, M, rspamd_symcache_item_name (cbd->item)); + } + else { + cbd->async_ev = rspamd_session_add_event (cbd->s, lua_udp_cbd_fin, + cbd, M); + } if (!cbd->async_ev) { return FALSE; -- 2.39.5