aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/controller.c14
-rw-r--r--src/libmime/smtp_proto.c20
-rw-r--r--src/libmime/smtp_utils.c12
-rw-r--r--src/libserver/dns.c4
-rw-r--r--src/libserver/events.c18
-rw-r--r--src/libserver/events.h10
-rw-r--r--src/libserver/task.c2
-rw-r--r--src/libstat/backends/redis.c2
-rw-r--r--src/lua/lua_http.c4
-rw-r--r--src/lua/lua_redis.c6
-rw-r--r--src/lua/lua_session.c8
-rw-r--r--src/lua/lua_tcp.c4
-rw-r--r--src/lua/lua_util.c2
-rw-r--r--src/plugins/fuzzy_check.c6
-rw-r--r--src/plugins/surbl.c6
-rw-r--r--src/smtp.c22
-rw-r--r--src/smtp_proxy.c38
-rw-r--r--src/worker.c8
-rw-r--r--test/rspamd_dkim_test.c4
-rw-r--r--test/rspamd_dns_test.c2
20 files changed, 96 insertions, 96 deletions
diff --git a/src/controller.c b/src/controller.c
index 0d8520058..46f4ed66e 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -995,7 +995,7 @@ rspamd_controller_handle_learn_common (
task->ev_base = ctx->ev_base;
- task->s = new_async_session (session->pool,
+ task->s = rspamd_session_create (session->pool,
rspamd_controller_learn_fin_task,
NULL,
rspamd_task_free_hard,
@@ -1009,14 +1009,14 @@ rspamd_controller_handle_learn_common (
if (!rspamd_task_process (task, msg, msg->body->str, msg->body->len, FALSE)) {
msg_warn ("filters cannot be processed for %s", task->message_id);
rspamd_controller_send_error (conn_ent, 500, task->last_error);
- destroy_session (task->s);
+ rspamd_session_destroy (task->s);
return 0;
}
session->task = task;
session->cl = cl;
session->is_spam = is_spam;
- check_session_pending (task->s);
+ rspamd_session_pending (task->s);
return 0;
}
@@ -1085,7 +1085,7 @@ rspamd_controller_handle_scan (struct rspamd_http_connection_entry *conn_ent,
task->resolver = ctx->resolver;
task->ev_base = ctx->ev_base;
- task->s = new_async_session (session->pool,
+ task->s = rspamd_session_create (session->pool,
rspamd_controller_check_fin_task,
NULL,
rspamd_task_free_hard,
@@ -1098,12 +1098,12 @@ rspamd_controller_handle_scan (struct rspamd_http_connection_entry *conn_ent,
if (!rspamd_task_process (task, msg, msg->body->str, msg->body->len, FALSE)) {
msg_warn ("filters cannot be processed for %s", task->message_id);
rspamd_controller_send_error (conn_ent, 500, task->last_error);
- destroy_session (task->s);
+ rspamd_session_destroy (task->s);
return 0;
}
session->task = task;
- check_session_pending (task->s);
+ rspamd_session_pending (task->s);
return 0;
}
@@ -1690,7 +1690,7 @@ rspamd_controller_finish_handler (struct rspamd_http_connection_entry *conn_ent)
session->ctx->worker->srv->stat->control_connections_count++;
if (session->task != NULL) {
- destroy_session (session->task->s);
+ rspamd_session_destroy (session->task->s);
}
if (session->pool) {
rspamd_mempool_delete (session->pool);
diff --git a/src/libmime/smtp_proto.c b/src/libmime/smtp_proto.c
index ec7ab191a..713efabac 100644
--- a/src/libmime/smtp_proto.c
+++ b/src/libmime/smtp_proto.c
@@ -425,7 +425,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (r == 1) {
@@ -476,7 +476,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (r == 1) {
@@ -512,7 +512,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (r == 1) {
@@ -545,7 +545,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (r == 1) {
@@ -638,7 +638,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (r == 1) {
@@ -650,7 +650,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
session->error, 0, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
session->state = SMTP_STATE_AFTER_DATA;
@@ -702,11 +702,11 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
sizeof (CRLF) - 1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else {
- remove_normal_event (session->s,
+ rspamd_session_remove_event (session->s,
(event_finalizer_t)smtp_upstream_finalize_connection,
session);
}
@@ -726,7 +726,7 @@ smtp_upstream_read_socket (rspamd_fstring_t * in, void *arg)
1, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
@@ -757,7 +757,7 @@ smtp_upstream_err_socket (GError *err, void *arg)
return;
}
rspamd_upstream_fail (session->upstream);
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
void
diff --git a/src/libmime/smtp_utils.c b/src/libmime/smtp_utils.c
index c4f0a7b3e..71f57a5b4 100644
--- a/src/libmime/smtp_utils.c
+++ b/src/libmime/smtp_utils.c
@@ -91,7 +91,7 @@ create_smtp_upstream_connection (struct smtp_session *session)
session);
session->state = SMTP_STATE_WAIT_UPSTREAM;
session->upstream_state = SMTP_STATE_GREETING;
- register_async_event (session->s,
+ rspamd_session_add_event (session->s,
(event_finalizer_t)smtp_upstream_finalize_connection,
session,
g_quark_from_static_string ("smtp proxy"));
@@ -120,7 +120,7 @@ err:
TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
@@ -286,7 +286,7 @@ write_smtp_reply (struct smtp_session *session)
1, FALSE, TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (cd.action <= METRIC_ACTION_ADD_HEADER || cd.action <=
@@ -300,7 +300,7 @@ write_smtp_reply (struct smtp_session *session)
0, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
@@ -345,7 +345,7 @@ write_smtp_reply (struct smtp_session *session)
0, FALSE, TRUE)) {
goto err;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
g_object_unref (stream);
@@ -359,6 +359,6 @@ err:
TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index 3e97160af..c92cf1990 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -62,7 +62,7 @@ rspamd_dns_callback (struct rdns_reply *reply, gpointer ud)
* event removing
*/
rdns_request_retain (reply->request);
- remove_normal_event (reqdata->session, rspamd_dns_fin_cb, reqdata);
+ rspamd_session_remove_event (reqdata->session, rspamd_dns_fin_cb, reqdata);
}
else if (reqdata->pool == NULL) {
g_slice_free1 (sizeof (struct rspamd_dns_request_ud), reqdata);
@@ -100,7 +100,7 @@ make_dns_request (struct rspamd_dns_resolver *resolver,
if (session) {
if (req != NULL) {
- register_async_event (session,
+ rspamd_session_add_event (session,
(event_finalizer_t)rspamd_dns_fin_cb,
reqdata,
g_quark_from_static_string ("dns resolver"));
diff --git a/src/libserver/events.c b/src/libserver/events.c
index 73ebef6a7..4925b8c69 100644
--- a/src/libserver/events.c
+++ b/src/libserver/events.c
@@ -90,7 +90,7 @@ rspamd_event_hash (gconstpointer a)
struct rspamd_async_session *
-new_async_session (rspamd_mempool_t * pool, session_finalizer_t fin,
+rspamd_session_create (rspamd_mempool_t * pool, session_finalizer_t fin,
event_finalizer_t restore, event_finalizer_t cleanup, void *user_data)
{
struct rspamd_async_session *new;
@@ -111,7 +111,7 @@ new_async_session (rspamd_mempool_t * pool, session_finalizer_t fin,
}
void
-register_async_event (struct rspamd_async_session *session,
+rspamd_session_add_event (struct rspamd_async_session *session,
event_finalizer_t fin,
void *user_data,
GQuark subsystem)
@@ -146,7 +146,7 @@ register_async_event (struct rspamd_async_session *session,
}
void
-remove_normal_event (struct rspamd_async_session *session,
+rspamd_session_remove_event (struct rspamd_async_session *session,
event_finalizer_t fin,
void *ud)
{
@@ -180,11 +180,11 @@ remove_normal_event (struct rspamd_async_session *session,
g_hash_table_remove (session->events, found_ev);
- check_session_pending (session);
+ rspamd_session_pending (session);
}
static gboolean
-rspamd_session_destroy (gpointer k, gpointer v, gpointer unused)
+rspamd_session_destroy_callback (gpointer k, gpointer v, gpointer unused)
{
struct rspamd_async_event *ev = v;
@@ -202,7 +202,7 @@ rspamd_session_destroy (gpointer k, gpointer v, gpointer unused)
}
gboolean
-destroy_session (struct rspamd_async_session *session)
+rspamd_session_destroy (struct rspamd_async_session *session)
{
if (session == NULL) {
msg_info ("session is NULL");
@@ -211,7 +211,7 @@ destroy_session (struct rspamd_async_session *session)
session->flags |= RSPAMD_SESSION_FLAG_DESTROYING;
g_hash_table_foreach_remove (session->events,
- rspamd_session_destroy,
+ rspamd_session_destroy_callback,
session);
if (session->cleanup != NULL) {
@@ -222,7 +222,7 @@ destroy_session (struct rspamd_async_session *session)
}
gboolean
-check_session_pending (struct rspamd_async_session *session)
+rspamd_session_pending (struct rspamd_async_session *session)
{
gboolean ret = TRUE;
@@ -233,7 +233,7 @@ check_session_pending (struct rspamd_async_session *session)
if (session->restore != NULL) {
session->restore (session->user_data);
/* Call pending once more */
- return check_session_pending (session);
+ return rspamd_session_pending (session);
}
}
else {
diff --git a/src/libserver/events.h b/src/libserver/events.h
index d78c79792..46f7ae0ef 100644
--- a/src/libserver/events.h
+++ b/src/libserver/events.h
@@ -44,7 +44,7 @@ typedef gboolean (*session_finalizer_t)(gpointer user_data);
* @param user_data abstract user data
* @return
*/
-struct rspamd_async_session * new_async_session (rspamd_mempool_t *pool,
+struct rspamd_async_session * rspamd_session_create (rspamd_mempool_t *pool,
session_finalizer_t fin, event_finalizer_t restore,
event_finalizer_t cleanup, gpointer user_data);
@@ -55,7 +55,7 @@ struct rspamd_async_session * new_async_session (rspamd_mempool_t *pool,
* @param user_data abstract user_data
* @param forced unused
*/
-void register_async_event (struct rspamd_async_session *session,
+void rspamd_session_add_event (struct rspamd_async_session *session,
event_finalizer_t fin, gpointer user_data, GQuark subsystem);
/**
@@ -64,7 +64,7 @@ void register_async_event (struct rspamd_async_session *session,
* @param fin final callback
* @param ud user data object
*/
-void remove_normal_event (struct rspamd_async_session *session,
+void rspamd_session_remove_event (struct rspamd_async_session *session,
event_finalizer_t fin,
gpointer ud);
@@ -72,14 +72,14 @@ void remove_normal_event (struct rspamd_async_session *session,
* Must be called at the end of session, it calls fin functions for all non-forced callbacks
* @return true if the whole session was destroyed and false if there are forced events
*/
-gboolean destroy_session (struct rspamd_async_session *session);
+gboolean rspamd_session_destroy (struct rspamd_async_session *session);
/**
* Check session for events pending and call fin callback if no events are pending
* @param session session object
* @return TRUE if session has pending events
*/
-gboolean check_session_pending (struct rspamd_async_session *session);
+gboolean rspamd_session_pending (struct rspamd_async_session *session);
/**
* Start watching for events in the session, so the specified watcher will be added
diff --git a/src/libserver/task.c b/src/libserver/task.c
index d4fae99db..502fdfb8d 100644
--- a/src/libserver/task.c
+++ b/src/libserver/task.c
@@ -358,7 +358,7 @@ rspamd_task_process (struct rspamd_task *task,
task->state = WAIT_PRE_FILTER;
}
- check_session_pending (task->s);
+ rspamd_session_pending (task->s);
return TRUE;
}
diff --git a/src/libstat/backends/redis.c b/src/libstat/backends/redis.c
index 070924689..deb2ea84d 100644
--- a/src/libstat/backends/redis.c
+++ b/src/libstat/backends/redis.c
@@ -417,7 +417,7 @@ rspamd_redis_runtime (struct rspamd_task *task,
g_assert (rt->redis != NULL);
redisLibeventAttach (rt->redis, task->ev_base);
- register_async_event (task->s, rspamd_redis_fin, rt,
+ rspamd_session_add_event (task->s, rspamd_redis_fin, rt,
rspamd_redis_stat_quark ());
return rt;
diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c
index 1baef5ed4..cec631402 100644
--- a/src/lua/lua_http.c
+++ b/src/lua/lua_http.c
@@ -122,7 +122,7 @@ static void
lua_http_maybe_free (struct lua_http_cbdata *cbd)
{
if (cbd->session) {
- remove_normal_event (cbd->session, lua_http_fin, cbd);
+ rspamd_session_remove_event (cbd->session, lua_http_fin, cbd);
}
else {
lua_http_fin (cbd);
@@ -438,7 +438,7 @@ lua_http_request (lua_State *L)
cbd->fd = -1;
if (session) {
cbd->session = session;
- register_async_event (session,
+ rspamd_session_add_event (session,
(event_finalizer_t)lua_http_fin,
cbd,
g_quark_from_static_string ("lua http"));
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 9cf10bb10..66a8c6cac 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -137,7 +137,7 @@ lua_redis_push_error (const gchar *err,
}
if (connected) {
- remove_normal_event (ud->task->s, lua_redis_fin, ud);
+ rspamd_session_remove_event (ud->task->s, lua_redis_fin, ud);
}
}
@@ -196,7 +196,7 @@ lua_redis_push_data (const redisReply *r, struct lua_redis_userdata *ud)
msg_info ("call to callback failed: %s", lua_tostring (ud->L, -1));
}
- remove_normal_event (ud->task->s, lua_redis_fin, ud);
+ rspamd_session_remove_event (ud->task->s, lua_redis_fin, ud);
}
/**
@@ -441,7 +441,7 @@ lua_redis_make_request (lua_State *L)
(const gchar **)ud->args,
NULL);
if (ret == REDIS_OK) {
- register_async_event (ud->task->s,
+ rspamd_session_add_event (ud->task->s,
lua_redis_fin,
ud,
g_quark_from_static_string ("lua redis"));
diff --git a/src/lua/lua_session.c b/src/lua/lua_session.c
index ccb8fd7b4..478d74b75 100644
--- a/src/lua/lua_session.c
+++ b/src/lua/lua_session.c
@@ -190,7 +190,7 @@ lua_session_create (lua_State *L)
}
}
- session = new_async_session (mempool,
+ session = rspamd_session_create (mempool,
lua_session_finalizer,
lua_session_restore,
lua_session_cleanup,
@@ -211,7 +211,7 @@ lua_session_delete (lua_State *L)
session = cbd->session;
if (session) {
- destroy_session (session);
+ rspamd_session_destroy (session);
return 0;
}
else {
@@ -256,7 +256,7 @@ lua_session_register_async_event (lua_State *L)
lua_pushvalue (L, 1);
cbdata->cbref = luaL_ref (L, LUA_REGISTRYINDEX);
cbdata->session = session;
- register_async_event (session,
+ rspamd_session_add_event (session,
lua_event_fin,
cbdata,
g_quark_from_static_string ("lua event"));
@@ -285,7 +285,7 @@ lua_session_remove_normal_event (lua_State *L)
if (session) {
data = lua_check_event (L, 2);
if (data) {
- remove_normal_event (session, lua_event_fin, data);
+ rspamd_session_remove_event (session, lua_event_fin, data);
return 0;
}
}
diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c
index 4cff7d0cc..fadb7d93b 100644
--- a/src/lua/lua_tcp.c
+++ b/src/lua/lua_tcp.c
@@ -120,7 +120,7 @@ static void
lua_tcp_maybe_free (struct lua_tcp_cbdata *cbd)
{
if (cbd->session) {
- remove_normal_event (cbd->session, lua_tcp_fin, cbd);
+ rspamd_session_remove_event (cbd->session, lua_tcp_fin, cbd);
}
else {
lua_tcp_fin (cbd);
@@ -593,7 +593,7 @@ lua_tcp_request (lua_State *L)
if (session) {
cbd->session = session;
- register_async_event (session,
+ rspamd_session_add_event (session,
(event_finalizer_t)lua_tcp_fin,
cbd,
g_quark_from_static_string ("lua tcp"));
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index 4442a3161..d93811dae 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -190,7 +190,7 @@ lua_util_process_message (lua_State *L)
task->fin_callback = lua_util_task_fin;
task->fin_arg = &res;
task->resolver = dns_resolver_init (NULL, base, cfg);
- task->s = new_async_session (task->task_pool, rspamd_task_fin,
+ task->s = rspamd_session_create (task->task_pool, rspamd_task_fin,
rspamd_task_restore, rspamd_task_free_hard, task);
if (rspamd_task_process (task, NULL, message, mlen, TRUE)) {
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c
index 498e1485e..ebaab2717 100644
--- a/src/plugins/fuzzy_check.c
+++ b/src/plugins/fuzzy_check.c
@@ -821,12 +821,12 @@ fuzzy_io_callback (gint fd, short what, void *arg)
errno,
strerror (errno));
rspamd_upstream_fail (session->server);
- remove_normal_event (session->task->s, fuzzy_io_fin, session);
+ rspamd_session_remove_event (session->task->s, fuzzy_io_fin, session);
}
else {
rspamd_upstream_ok (session->server);
if (session->commands->len == 0) {
- remove_normal_event (session->task->s, fuzzy_io_fin, session);
+ rspamd_session_remove_event (session->task->s, fuzzy_io_fin, session);
}
}
}
@@ -1114,7 +1114,7 @@ register_fuzzy_client_call (struct rspamd_task *task,
session->server = selected;
session->rule = rule;
event_add (&session->ev, &session->tv);
- register_async_event (task->s,
+ rspamd_session_add_event (task->s,
fuzzy_io_fin,
session,
g_quark_from_static_string ("fuzzy check"));
diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 39dfc2894..39a6e2974 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -937,7 +937,7 @@ surbl_redirector_error (struct rspamd_http_connection *conn,
rspamd_inet_address_to_string (rspamd_upstream_addr (param->redirector)),
err);
rspamd_upstream_fail (param->redirector);
- remove_normal_event (param->task->s, free_redirector_session,
+ rspamd_session_remove_event (param->task->s, free_redirector_session,
param);
}
@@ -981,7 +981,7 @@ surbl_redirector_finish (struct rspamd_http_connection *conn,
}
rspamd_upstream_ok (param->redirector);
- remove_normal_event (param->task->s, free_redirector_session,
+ rspamd_session_remove_event (param->task->s, free_redirector_session,
param);
return 0;
@@ -1032,7 +1032,7 @@ register_redirector_call (struct rspamd_url *url, struct rspamd_task *task,
timeout = rspamd_mempool_alloc (task->task_pool, sizeof (struct timeval));
double_to_tv (surbl_module_ctx->read_timeout, timeout);
- register_async_event (task->s,
+ rspamd_session_add_event (task->s,
free_redirector_session,
param,
g_quark_from_static_string ("surbl"));
diff --git a/src/smtp.c b/src/smtp.c
index 343d1d557..74e2323a2 100644
--- a/src/smtp.c
+++ b/src/smtp.c
@@ -188,7 +188,7 @@ read_smtp_command (struct smtp_session *session, rspamd_fstring_t *line)
g_list_free (session->rcpt);
}
if (session->upstream) {
- remove_normal_event (session->s,
+ rspamd_session_remove_event (session->s,
smtp_upstream_finalize_connection,
session);
session->upstream = NULL;
@@ -323,7 +323,7 @@ process_smtp_data (struct smtp_session *session)
/* We want fin_task after pre filters are processed */
session->task->s->wanna_die = TRUE;
session->task->state = WAIT_PRE_FILTER;
- check_session_pending (session->task->s);
+ rspamd_session_pending (session->task->s);
}
}
else {
@@ -342,7 +342,7 @@ err:
TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
@@ -378,7 +378,7 @@ smtp_read_socket (rspamd_fstring_t * in, void *arg)
session->error, 0, FALSE, TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
if (!smtp_write_socket (session)) {
@@ -403,7 +403,7 @@ smtp_read_socket (rspamd_fstring_t * in, void *arg)
0, FALSE, TRUE)) {
return FALSE;
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
break;
@@ -420,7 +420,7 @@ smtp_read_socket (rspamd_fstring_t * in, void *arg)
}
if (session->state == SMTP_STATE_QUIT) {
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (session->state == SMTP_STATE_WAIT_UPSTREAM) {
@@ -445,7 +445,7 @@ smtp_write_socket (void *arg)
return FALSE;
}
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else if (session->state == SMTP_STATE_END) {
@@ -483,7 +483,7 @@ smtp_err_socket (GError * err, void *arg)
msg_info ("abnormally closing connection, error: %s", err->message);
/* Free buffers */
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
/*
@@ -510,7 +510,7 @@ smtp_delay_handler (gint fd, short what, void *arg)
{
struct smtp_session *session = arg;
- remove_normal_event (session->s,
+ rspamd_session_remove_event (session->s,
(event_finalizer_t)event_del,
session->delay_timer);
if (session->state == SMTP_STATE_DELAY) {
@@ -546,7 +546,7 @@ smtp_make_delay (struct smtp_session *session)
evtimer_set (tev, smtp_delay_handler, session);
evtimer_add (tev, tv);
- register_async_event (session->s,
+ rspamd_session_add_event (session->s,
(event_finalizer_t)event_del,
tev,
g_quark_from_static_string ("smtp proxy"));
@@ -710,7 +710,7 @@ accept_socket (gint fd, short what, void *arg)
/* Resolve client's addr */
/* Set up async session */
- session->s = new_async_session (session->pool,
+ session->s = rspamd_session_create (session->pool,
NULL,
NULL,
free_smtp_session,
diff --git a/src/smtp_proxy.c b/src/smtp_proxy.c
index a86c828c0..281c93b6b 100644
--- a/src/smtp_proxy.c
+++ b/src/smtp_proxy.c
@@ -193,7 +193,7 @@ smtp_proxy_err_proxy (GError * err, void *arg)
}
/* Free buffers */
session->state = SMTP_PROXY_STATE_REJECT;
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
/**
@@ -280,7 +280,7 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
msg_info ("connection with %s got write error: %s",
inet_ntoa (session->client_addr),
strerror (errno));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else {
@@ -305,7 +305,7 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
msg_info ("connection with %s got write error: %s",
inet_ntoa (session->client_addr),
strerror (errno));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
}
@@ -313,14 +313,14 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
/* Proxy sent 500 error */
msg_info ("connection with %s got smtp error for greeting",
rspamd_upstream_name (session->upstream));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else {
msg_info ("connection with %s got read error: %s",
rspamd_upstream_name (session->upstream),
strerror (errno));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else if (session->state == SMTP_PROXY_STATE_XCLIENT) {
@@ -352,14 +352,14 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
msg_info ("connection with %s got write error: %s",
inet_ntoa (session->client_addr),
strerror (errno));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else if (r == -1) {
/* Proxy sent 500 error */
msg_info ("connection with %s got smtp error for xclient",
rspamd_upstream_name (session->upstream));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
}
@@ -367,7 +367,7 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
msg_info ("connection with %s got read event at improper state: %d",
rspamd_upstream_name (session->upstream),
session->state);
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else if (what == EV_WRITE) {
@@ -401,7 +401,7 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
msg_info ("connection with %s got write error: %s",
rspamd_upstream_name (session->upstream),
strerror (errno));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else {
@@ -409,14 +409,14 @@ smtp_proxy_greeting_handler (gint fd, short what, void *arg)
"connection with %s got write event at improper state: %d",
rspamd_upstream_name (session->upstream),
session->state);
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
else {
/* Timeout */
msg_info ("connection with %s timed out",
rspamd_upstream_name (session->upstream));
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
}
@@ -573,7 +573,7 @@ smtp_delay_handler (gint fd, short what, void *arg)
{
struct smtp_proxy_session *session = arg;
- remove_normal_event (session->s, (event_finalizer_t) event_del,
+ rspamd_session_remove_event (session->s, (event_finalizer_t) event_del,
session->delay_timer);
if (session->state == SMTP_PROXY_STATE_DELAY) {
/* TODO: Create upstream connection here */
@@ -623,7 +623,7 @@ smtp_make_delay (struct smtp_proxy_session *session)
evtimer_set (tev, smtp_delay_handler, session);
evtimer_add (tev, tv);
- register_async_event (session->s, (event_finalizer_t) event_del, tev,
+ rspamd_session_add_event (session->s, (event_finalizer_t) event_del, tev,
g_quark_from_static_string ("smtp proxy"));
session->delay_timer = tev;
}
@@ -800,7 +800,7 @@ smtp_proxy_read_socket (rspamd_fstring_t * in, void *arg)
0, FALSE, TRUE)) {
msg_err ("cannot write smtp error");
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
else {
/* Try to extract data */
@@ -821,7 +821,7 @@ smtp_proxy_read_socket (rspamd_fstring_t * in, void *arg)
0, FALSE, TRUE)) {
msg_err ("cannot write smtp error");
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
if (session->rcpt != NULL) {
@@ -832,7 +832,7 @@ smtp_proxy_read_socket (rspamd_fstring_t * in, void *arg)
0, FALSE, TRUE)) {
msg_err ("cannot write smtp error");
}
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
return rspamd_dispatcher_write (session->dispatcher,
@@ -862,7 +862,7 @@ smtp_proxy_write_socket (void *arg)
struct smtp_proxy_session *session = arg;
if (session->ctx->instant_reject) {
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
return FALSE;
}
else {
@@ -893,7 +893,7 @@ smtp_proxy_err_socket (GError * err, void *arg)
g_error_free (err);
}
/* Free buffers */
- destroy_session (session->s);
+ rspamd_session_destroy (session->s);
}
/*
@@ -941,7 +941,7 @@ accept_socket (gint fd, short what, void *arg)
/* Resolve client's addr */
/* Set up async session */
- session->s = new_async_session (session->pool,
+ session->s = rspamd_session_create (session->pool,
NULL,
NULL,
free_smtp_proxy_session,
diff --git a/src/worker.c b/src/worker.c
index dec3d679f..ec8fb464c 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -140,7 +140,7 @@ rspamd_worker_error_handler (struct rspamd_http_connection *conn, GError *err)
msg_info ("abnormally closing connection from: %s, error: %e",
rspamd_inet_address_to_string (task->client_addr), err);
/* Terminate session immediately */
- destroy_session (task->s);
+ rspamd_session_destroy (task->s);
}
static gint
@@ -153,7 +153,7 @@ rspamd_worker_finish_handler (struct rspamd_http_connection *conn,
/* We are done here */
msg_debug ("normally closing connection from: %s",
rspamd_inet_address_to_string (task->client_addr));
- destroy_session (task->s);
+ rspamd_session_destroy (task->s);
}
else if (task->state == WRITE_REPLY) {
/*
@@ -172,7 +172,7 @@ rspamd_worker_finish_handler (struct rspamd_http_connection *conn,
* If all filters have finished their tasks, this function will trigger
* writing a reply.
*/
- check_session_pending (task->s);
+ rspamd_session_pending (task->s);
}
return 0;
@@ -242,7 +242,7 @@ accept_socket (gint fd, short what, void *arg)
(rspamd_mempool_destruct_t)reduce_tasks_count, &ctx->tasks);
/* Set up async session */
- new_task->s = new_async_session (new_task->task_pool, rspamd_task_fin,
+ new_task->s = rspamd_session_create (new_task->task_pool, rspamd_task_fin,
rspamd_task_restore, rspamd_task_free_hard, new_task);
if (ctx->key) {
diff --git a/test/rspamd_dkim_test.c b/test/rspamd_dkim_test.c
index b0491de0b..81500dcc5 100644
--- a/test/rspamd_dkim_test.c
+++ b/test/rspamd_dkim_test.c
@@ -42,7 +42,7 @@ test_key_handler (rspamd_dkim_key_t *key, gsize keylen, rspamd_dkim_context_t *c
struct rspamd_async_session *s = ud;
g_assert (key != NULL);
- destroy_session (s);
+ rspamd_session_destroy (s);
}
static gboolean
@@ -85,7 +85,7 @@ rspamd_dkim_test_func ()
g_assert (ctx != NULL);
/* Key part */
- s = new_async_session (pool, session_fin, NULL, NULL, NULL);
+ s = rspamd_session_create (pool, session_fin, NULL, NULL, NULL);
g_assert (rspamd_get_dkim_key (ctx, resolver, s, test_key_handler, s));
diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c
index 5728b5a2d..dd2447d9c 100644
--- a/test/rspamd_dns_test.c
+++ b/test/rspamd_dns_test.c
@@ -80,7 +80,7 @@ rspamd_dns_test_func ()
pool = rspamd_mempool_new (rspamd_mempool_suggest_size ());
- s = new_async_session (pool, session_fin, NULL, NULL, NULL);
+ s = rspamd_session_create (pool, session_fin, NULL, NULL, NULL);
resolver = dns_resolver_init (NULL, base, cfg);