diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-24 18:26:07 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-24 18:26:07 +0100 |
commit | 3fbcbfe4605d78e27e083ce708258fda796424eb (patch) | |
tree | 07d56102e9a481db2d28c227966628e878c1e87e | |
parent | 3f9fc337ce886a526aca60259bd83faa34ec2c38 (diff) | |
download | rspamd-3fbcbfe4605d78e27e083ce708258fda796424eb.tar.gz rspamd-3fbcbfe4605d78e27e083ce708258fda796424eb.zip |
[Minor] Some fixes in surbl module events processing
-rw-r--r-- | src/libserver/symbols_cache.c | 8 | ||||
-rw-r--r-- | src/plugins/surbl.c | 11 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index c4acf1f84..960171e1c 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -2666,8 +2666,8 @@ guint rspamd_symcache_item_async_inc (struct rspamd_task *task, struct rspamd_symcache_item *item) { - msg_debug_cache_task ("increase async events counter for %s = %d + 1", - item->symbol, item->async_events); + msg_debug_cache_task ("increase async events counter for %s(%d) = %d + 1", + item->symbol, item->id, item->async_events); return ++item->async_events; } @@ -2675,8 +2675,8 @@ guint rspamd_symcache_item_async_dec (struct rspamd_task *task, struct rspamd_symcache_item *item) { - msg_debug_cache_task ("decrease async events counter for %s = %d - 1", - item->symbol, item->async_events); + msg_debug_cache_task ("decrease async events counter for %s(%d) = %d - 1", + item->symbol, item->id, item->async_events); g_assert (item->async_events > 0); return --item->async_events; diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c index 52bfe42ca..8070bfb23 100644 --- a/src/plugins/surbl.c +++ b/src/plugins/surbl.c @@ -1574,6 +1574,10 @@ free_redirector_session (void *ud) { struct redirector_param *param = (struct redirector_param *)ud; + if (param->item) { + rspamd_symcache_item_async_dec_check (param->task, param->item); + } + rspamd_http_connection_unref (param->conn); close (param->sock); } @@ -1682,6 +1686,7 @@ register_redirector_call (struct rspamd_url *url, struct rspamd_task *task, msg_info_surbl ("<%s> cannot create tcp socket failed: %s", task->message_id, strerror (errno)); + return; } @@ -1710,6 +1715,10 @@ register_redirector_call (struct rspamd_url *url, struct rspamd_task *task, g_quark_from_static_string ("surbl")); param->item = rspamd_symbols_cache_get_cur_item (task); + if (param->item) { + rspamd_symcache_item_async_inc (param->task, param->item); + } + rspamd_http_connection_write_message (param->conn, msg, NULL, NULL, param, s, timeout, task->ev_base); @@ -1904,7 +1913,7 @@ surbl_test_url (struct rspamd_task *task, param->tree = g_hash_table_new (rspamd_strcase_hash, rspamd_strcase_equal); param->ctx = surbl_module_ctx; param->item = item; - rspamd_symcache_item_async_inc (task, item); + rspamd_mempool_add_destructor (task->task_pool, (rspamd_mempool_destruct_t)g_hash_table_unref, param->tree); |