]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Slightly improve session events logging
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 28 Dec 2021 20:15:50 +0000 (20:15 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 28 Dec 2021 20:15:50 +0000 (20:15 +0000)
src/lua/lua_http.c
src/lua/lua_tcp.c
src/lua/lua_udp.c

index e4a3bedb18b7c3cdb2fcdf946752858bdbaf2e3d..ce2a48d631aa9c662631291d26faefff33bc5416 100644 (file)
@@ -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;
                }
 
index f15e2539995082739c7cb35d7149ad84bf99ead5..37f535850add92c69c7b38ace0bd71e762a8480c 100644 (file)
@@ -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;
index 5d1fd8c62e273acdb0e3e2c46c7803d1efed8ac2..656d8034909ae16094784ef7784b77ec284f5619 100644 (file)
@@ -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;