From 98897c179754fb04762d325c83f1e057b44697a3 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 15 Jun 2019 16:37:58 +0100 Subject: [PATCH] [Project] First refactoring step libevent->libev --- CMakeLists.txt | 2 -- contrib/cdb/cdb.h | 1 - src/client/rspamc.c | 6 +++--- src/client/rspamdclient.c | 4 ++-- src/client/rspamdclient.h | 4 ++-- src/controller.c | 6 +++--- src/fuzzy_storage.c | 2 +- src/hs_helper.c | 2 +- src/libserver/dkim.h | 2 +- src/libserver/dns.c | 13 +++++++------ src/libserver/dns.h | 4 ++-- src/libserver/fuzzy_backend.c | 6 +++--- src/libserver/fuzzy_backend.h | 6 +++--- src/libserver/fuzzy_backend_redis.c | 2 +- src/libserver/milter.c | 2 +- src/libserver/milter.h | 4 ++-- src/libserver/milter_internal.h | 4 ++-- src/libserver/monitored.c | 6 +++--- src/libserver/monitored.h | 4 ++-- src/libserver/redis_pool.c | 16 ++++++++-------- src/libserver/redis_pool.h | 4 ++-- src/libserver/rspamd_control.c | 10 +++++----- src/libserver/rspamd_control.h | 8 ++++---- src/libserver/rspamd_symcache.c | 8 ++++---- src/libserver/rspamd_symcache.h | 4 ++-- src/libserver/task.c | 4 ++-- src/libserver/task.h | 4 ++-- src/libserver/worker_util.c | 22 +++++++++++----------- src/libserver/worker_util.h | 12 ++++++------ src/libstat/backends/redis_backend.c | 16 ++++++++-------- src/libstat/classifiers/bayes.c | 2 +- src/libstat/classifiers/classifiers.h | 8 ++++---- src/libstat/classifiers/lua_classifier.c | 2 +- src/libstat/learn_cache/redis_cache.c | 6 +++--- src/libstat/stat_api.h | 4 ++-- src/libstat/stat_config.c | 2 +- src/libstat/stat_internal.h | 2 +- src/libutil/addr.c | 2 +- src/libutil/aio_event.c | 6 +++--- src/libutil/aio_event.h | 2 +- src/libutil/http_connection.h | 2 +- src/libutil/http_context.c | 8 ++++---- src/libutil/http_context.h | 8 ++++---- src/libutil/http_private.h | 2 +- src/libutil/http_router.h | 2 +- src/libutil/map.c | 2 +- src/libutil/map.h | 4 ++-- src/libutil/map_private.h | 4 ++-- src/libutil/ssl_util.c | 4 ++-- src/libutil/ssl_util.h | 2 +- src/libutil/upstream.c | 4 ++-- src/libutil/upstream.h | 2 +- src/libutil/util.c | 2 +- src/libutil/util.h | 11 +---------- src/log_helper.c | 4 ++-- src/lua/lua_common.c | 8 ++++---- src/lua/lua_common.h | 4 ++-- src/lua/lua_config.c | 8 ++++---- src/lua/lua_dns_resolver.c | 2 +- src/lua/lua_fann.c | 2 +- src/lua/lua_http.c | 12 ++++++------ src/lua/lua_redis.c | 6 +++--- src/lua/lua_task.c | 10 +++++----- src/lua/lua_tcp.c | 14 +++++++------- src/lua/lua_udp.c | 8 ++++---- src/lua/lua_util.c | 8 ++++---- src/lua/lua_worker.c | 2 +- src/lua_worker.c | 6 +++--- src/plugins/fuzzy_check.c | 18 +++++++++--------- src/rspamadm/control.c | 6 +++--- src/rspamadm/lua_repl.c | 6 +++--- src/rspamadm/rspamadm.c | 16 ++++++++-------- src/rspamd.c | 18 +++++++++--------- src/rspamd.h | 8 ++++---- src/rspamd_proxy.c | 2 +- src/worker.c | 6 +++--- src/worker_private.h | 4 ++-- test/rspamd_async_test.c | 2 +- test/rspamd_dkim_test.c | 2 +- test/rspamd_dns_test.c | 2 +- test/rspamd_http_test.c | 8 ++++---- test/rspamd_test_suite.c | 2 +- test/rspamd_upstream_test.c | 2 +- utils/rspamd_http_bench.c | 8 ++++---- utils/rspamd_http_server.c | 10 +++++----- 85 files changed, 242 insertions(+), 253 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 122b37246..893cce7f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -649,8 +649,6 @@ ELSE() ROOT ${PCRE_ROOT_DIR} MODULES pcre libpcre pcre3 libpcre3) ENDIF() -ProcessPackage(LIBEVENT LIBRARY event INCLUDE event.h INCLUDE_SUFFIXES include/event - ROOT ${LIBEVENT_ROOT_DIR} MODULES event libevent) ProcessPackage(SQLITE3 LIBRARY sqlite3 INCLUDE sqlite3.h INCLUDE_SUFFIXES include/sqlite3 include/sqlite ROOT ${SQLITE3_ROOT_DIR} MODULES sqlite3 sqlite) ProcessPackage(ICUDATA LIBRARY icudata INCLUDE unicode/ucnv.h diff --git a/contrib/cdb/cdb.h b/contrib/cdb/cdb.h index 959c24f1f..f8071fa38 100644 --- a/contrib/cdb/cdb.h +++ b/contrib/cdb/cdb.h @@ -10,7 +10,6 @@ #include "config.h" #include "unix-std.h" -#include /* * OpenBSD fix diff --git a/src/client/rspamc.c b/src/client/rspamc.c index 2f572c449..3bfc785d8 100644 --- a/src/client/rspamc.c +++ b/src/client/rspamc.c @@ -1609,7 +1609,7 @@ rspamc_client_cb (struct rspamd_client_connection *conn, } static void -rspamc_process_input (struct event_base *ev_base, struct rspamc_command *cmd, +rspamc_process_input (struct ev_loop *ev_base, struct rspamc_command *cmd, FILE *in, const gchar *name, GQueue *attrs) { struct rspamd_client_connection *conn; @@ -1736,7 +1736,7 @@ rspamd_dirent_size (DIR * dirp) } static void -rspamc_process_dir (struct event_base *ev_base, struct rspamc_command *cmd, +rspamc_process_dir (struct ev_loop *ev_base, struct rspamc_command *cmd, const gchar *name, GQueue *attrs) { DIR *d; @@ -1863,7 +1863,7 @@ main (gint argc, gchar **argv, gchar **env) GPid cld; struct rspamc_command *cmd; FILE *in = NULL; - struct event_base *ev_base; + struct ev_loop *ev_base; struct stat st; struct sigaction sigpipe_act; gchar **exclude_pattern; diff --git a/src/client/rspamdclient.c b/src/client/rspamdclient.c index 5f831ee64..1e6fdb999 100644 --- a/src/client/rspamdclient.c +++ b/src/client/rspamdclient.c @@ -37,7 +37,7 @@ struct rspamd_client_connection { GString *server_name; struct rspamd_cryptobox_pubkey *key; struct rspamd_cryptobox_keypair *keypair; - struct event_base *ev_base; + struct ev_loop *ev_base; struct timeval timeout; struct rspamd_http_connection *http_conn; gboolean req_sent; @@ -240,7 +240,7 @@ rspamd_client_finish_handler (struct rspamd_http_connection *conn, struct rspamd_client_connection * rspamd_client_init (struct rspamd_http_context *http_ctx, - struct event_base *ev_base, const gchar *name, + struct ev_loop *ev_base, const gchar *name, guint16 port, gdouble timeout, const gchar *key) { struct rspamd_client_connection *conn; diff --git a/src/client/rspamdclient.h b/src/client/rspamdclient.h index 8a5b3de35..9fced29af 100644 --- a/src/client/rspamdclient.h +++ b/src/client/rspamdclient.h @@ -18,7 +18,7 @@ #include "config.h" #include "ucl.h" -#include +#include "contrib/libev/ev.h" struct rspamd_client_connection; struct rspamd_http_message; @@ -58,7 +58,7 @@ struct rspamd_http_context; */ struct rspamd_client_connection * rspamd_client_init ( struct rspamd_http_context *http_ctx, - struct event_base *ev_base, + struct ev_loop *ev_base, const gchar *name, guint16 port, gdouble timeout, diff --git a/src/controller.c b/src/controller.c index 8dcbdb33f..bf74f03a3 100644 --- a/src/controller.c +++ b/src/controller.c @@ -132,7 +132,7 @@ worker_t controller_worker = { struct rspamd_controller_worker_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ @@ -3480,12 +3480,12 @@ static int lua_csession_get_ev_base (lua_State *L) { struct rspamd_http_connection_entry *c = lua_check_controller_entry (L, 1); - struct event_base **pbase; + struct ev_loop **pbase; struct rspamd_controller_session *s; if (c) { s = c->ud; - pbase = lua_newuserdata (L, sizeof (struct event_base *)); + pbase = lua_newuserdata (L, sizeof (struct ev_loop *)); rspamd_lua_setclass (L, "rspamd{ev_base}", -1); *pbase = s->ctx->ev_base; } diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 43c975459..86a4230de 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -132,7 +132,7 @@ static const guint64 rspamd_fuzzy_storage_magic = 0x291a3253eb1b3ea5ULL; struct rspamd_fuzzy_storage_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ diff --git a/src/hs_helper.c b/src/hs_helper.c index 94a46af8c..9f0a0ab33 100644 --- a/src/hs_helper.c +++ b/src/hs_helper.c @@ -47,7 +47,7 @@ static const guint64 rspamd_hs_helper_magic = 0x22d310157a2288a0ULL; struct hs_helper_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ diff --git a/src/libserver/dkim.h b/src/libserver/dkim.h index fe2b4cc4e..57f761895 100644 --- a/src/libserver/dkim.h +++ b/src/libserver/dkim.h @@ -17,7 +17,7 @@ #define DKIM_H_ #include "config.h" -#include "event.h" +#include "contrib/libev/ev.h" #include "dns.h" #include "ref.h" diff --git a/src/libserver/dns.c b/src/libserver/dns.c index 54b97d06a..5277e2f6c 100644 --- a/src/libserver/dns.c +++ b/src/libserver/dns.c @@ -14,13 +14,14 @@ * limitations under the License. */ -#include -#include + #include "config.h" #include "dns.h" #include "rspamd.h" #include "utlist.h" -#include "rdns_event.h" +#include "contrib/librdns/rdns.h" +#include "contrib/librdns/dns_private.h" +#include "contrib/librdns/rdns_ev.h" #include "unix-std.h" static const gchar *M = "rspamd dns"; @@ -532,13 +533,13 @@ rspamd_dns_resolver_config_ucl (struct rspamd_config *cfg, struct rspamd_dns_resolver * rspamd_dns_resolver_init (rspamd_logger_t *logger, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_config *cfg) { struct rspamd_dns_resolver *dns_resolver; dns_resolver = g_malloc0 (sizeof (struct rspamd_dns_resolver)); - dns_resolver->ev_base = ev_base; + dns_resolver->event_loop = ev_base; if (cfg != NULL) { dns_resolver->request_timeout = cfg->dns_timeout; dns_resolver->max_retransmits = cfg->dns_retransmits; @@ -549,7 +550,7 @@ rspamd_dns_resolver_init (rspamd_logger_t *logger, } dns_resolver->r = rdns_resolver_new (); - rdns_bind_libevent (dns_resolver->r, dns_resolver->ev_base); + rdns_bind_libev (dns_resolver->r, dns_resolver->event_loop); if (cfg != NULL) { rdns_resolver_set_log_level (dns_resolver->r, cfg->log_level); diff --git a/src/libserver/dns.h b/src/libserver/dns.h index 158ac504e..c744ac42e 100644 --- a/src/libserver/dns.h +++ b/src/libserver/dns.h @@ -28,7 +28,7 @@ struct rspamd_config; struct rspamd_dns_resolver { struct rdns_resolver *r; - struct event_base *ev_base; + struct ev_loop *event_loop; struct upstream_list *ups; struct rspamd_config *cfg; gdouble request_timeout; @@ -41,7 +41,7 @@ struct rspamd_dns_resolver { * Init DNS resolver, params are obtained from a config file or system file /etc/resolv.conf */ struct rspamd_dns_resolver * rspamd_dns_resolver_init (rspamd_logger_t *logger, - struct event_base *ev_base, struct rspamd_config *cfg); + struct ev_loop *ev_base, struct rspamd_config *cfg); struct rspamd_dns_request_ud; /** diff --git a/src/libserver/fuzzy_backend.c b/src/libserver/fuzzy_backend.c index 6de977ff6..f52fcca99 100644 --- a/src/libserver/fuzzy_backend.c +++ b/src/libserver/fuzzy_backend.c @@ -105,7 +105,7 @@ struct rspamd_fuzzy_backend { enum rspamd_fuzzy_backend_type type; gdouble expire; gdouble sync; - struct event_base *ev_base; + struct ev_loop *ev_base; rspamd_fuzzy_periodic_cb periodic_cb; void *periodic_ud; const struct rspamd_fuzzy_backend_subr *subr; @@ -271,7 +271,7 @@ rspamd_fuzzy_backend_close_sqlite (struct rspamd_fuzzy_backend *bk, struct rspamd_fuzzy_backend * -rspamd_fuzzy_backend_create (struct event_base *ev_base, +rspamd_fuzzy_backend_create (struct ev_loop *ev_base, const ucl_object_t *config, struct rspamd_config *cfg, GError **err) @@ -559,7 +559,7 @@ rspamd_fuzzy_backend_close (struct rspamd_fuzzy_backend *bk) g_free (bk); } -struct event_base* +struct ev_loop* rspamd_fuzzy_backend_event_base (struct rspamd_fuzzy_backend *backend) { return backend->ev_base; diff --git a/src/libserver/fuzzy_backend.h b/src/libserver/fuzzy_backend.h index f26f3a582..1519761e0 100644 --- a/src/libserver/fuzzy_backend.h +++ b/src/libserver/fuzzy_backend.h @@ -17,7 +17,7 @@ #define SRC_LIBSERVER_FUZZY_BACKEND_H_ #include "config.h" -#include +#include "contrib/libev/ev.h" #include "fuzzy_wire.h" struct rspamd_fuzzy_backend; @@ -44,7 +44,7 @@ typedef gboolean (*rspamd_fuzzy_periodic_cb) (void *ud); * @param err * @return */ -struct rspamd_fuzzy_backend * rspamd_fuzzy_backend_create (struct event_base *ev_base, +struct rspamd_fuzzy_backend * rspamd_fuzzy_backend_create (struct ev_loop *ev_base, const ucl_object_t *config, struct rspamd_config *cfg, GError **err); @@ -106,7 +106,7 @@ void rspamd_fuzzy_backend_start_update (struct rspamd_fuzzy_backend *backend, rspamd_fuzzy_periodic_cb cb, void *ud); -struct event_base* rspamd_fuzzy_backend_event_base (struct rspamd_fuzzy_backend *backend); +struct ev_loop* rspamd_fuzzy_backend_event_base (struct rspamd_fuzzy_backend *backend); gdouble rspamd_fuzzy_backend_get_expire (struct rspamd_fuzzy_backend *backend); /** diff --git a/src/libserver/fuzzy_backend_redis.c b/src/libserver/fuzzy_backend_redis.c index 956979d42..df9103e30 100644 --- a/src/libserver/fuzzy_backend_redis.c +++ b/src/libserver/fuzzy_backend_redis.c @@ -73,7 +73,7 @@ struct rspamd_fuzzy_redis_session { redisAsyncContext *ctx; struct event timeout; const struct rspamd_fuzzy_cmd *cmd; - struct event_base *ev_base; + struct ev_loop *ev_base; float prob; gboolean shingles_checked; diff --git a/src/libserver/milter.c b/src/libserver/milter.c index 188ff42d9..ecd66cfe6 100644 --- a/src/libserver/milter.c +++ b/src/libserver/milter.c @@ -1085,7 +1085,7 @@ rspamd_milter_handle_session (struct rspamd_milter_session *session, gboolean rspamd_milter_handle_socket (gint fd, const struct timeval *tv, rspamd_mempool_t *pool, - struct event_base *ev_base, rspamd_milter_finish finish_cb, + struct ev_loop *ev_base, rspamd_milter_finish finish_cb, rspamd_milter_error error_cb, void *ud) { struct rspamd_milter_session *session; diff --git a/src/libserver/milter.h b/src/libserver/milter.h index 10bf34d52..c01538f75 100644 --- a/src/libserver/milter.h +++ b/src/libserver/milter.h @@ -41,7 +41,7 @@ enum rspamd_milter_reply { }; struct rspamd_email_address; -struct event_base; +struct ev_loop; struct rspamd_http_message; struct rspamd_config; @@ -83,7 +83,7 @@ typedef void (*rspamd_milter_error) (gint fd, */ gboolean rspamd_milter_handle_socket (gint fd, const struct timeval *tv, rspamd_mempool_t *pool, - struct event_base *ev_base, rspamd_milter_finish finish_cb, + struct ev_loop *ev_base, rspamd_milter_finish finish_cb, rspamd_milter_error error_cb, void *ud); /** diff --git a/src/libserver/milter_internal.h b/src/libserver/milter_internal.h index 1e4b7b187..7da696b36 100644 --- a/src/libserver/milter_internal.h +++ b/src/libserver/milter_internal.h @@ -19,7 +19,7 @@ #include "config.h" #include "libutil/mem_pool.h" -#include +#include "contrib/libev/ev.h" #include "khash.h" #include "libutil/str_util.h" @@ -63,7 +63,7 @@ struct rspamd_milter_private { struct timeval tv; struct rspamd_milter_outbuf *out_chain; struct timeval *ptv; - struct event_base *ev_base; + struct ev_loop *ev_base; rspamd_mempool_t *pool; khash_t(milter_headers_hash_t) *headers; gint cur_hdr; diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c index ddef9ffe3..2e876242b 100644 --- a/src/libserver/monitored.c +++ b/src/libserver/monitored.c @@ -39,7 +39,7 @@ struct rspamd_monitored_methods { struct rspamd_monitored_ctx { struct rspamd_config *cfg; struct rdns_resolver *resolver; - struct event_base *ev_base; + struct ev_loop *ev_base; GPtrArray *elts; GHashTable *helts; mon_change_cb change_cb; @@ -427,7 +427,7 @@ rspamd_monitored_ctx_init (void) void rspamd_monitored_ctx_config (struct rspamd_monitored_ctx *ctx, struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rdns_resolver *resolver, mon_change_cb change_cb, gpointer ud) @@ -457,7 +457,7 @@ rspamd_monitored_ctx_config (struct rspamd_monitored_ctx *ctx, } -struct event_base * +struct ev_loop * rspamd_monitored_ctx_get_ev_base (struct rspamd_monitored_ctx *ctx) { return ctx->ev_base; diff --git a/src/libserver/monitored.h b/src/libserver/monitored.h index 4db41f9c2..0189e0e6c 100644 --- a/src/libserver/monitored.h +++ b/src/libserver/monitored.h @@ -52,12 +52,12 @@ typedef void (*mon_change_cb) (struct rspamd_monitored_ctx *ctx, */ void rspamd_monitored_ctx_config (struct rspamd_monitored_ctx *ctx, struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rdns_resolver *resolver, mon_change_cb change_cb, gpointer ud); -struct event_base *rspamd_monitored_ctx_get_ev_base (struct rspamd_monitored_ctx *ctx); +struct ev_loop *rspamd_monitored_ctx_get_ev_base (struct rspamd_monitored_ctx *ctx); /** * Create monitored object diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c index 528a990a1..d7e8015e5 100644 --- a/src/libserver/redis_pool.c +++ b/src/libserver/redis_pool.c @@ -15,12 +15,12 @@ */ #include "config.h" -#include +#include "contrib/libev/ev.h" #include "redis_pool.h" #include "cfg_file.h" #include "contrib/hiredis/hiredis.h" #include "contrib/hiredis/async.h" -#include "contrib/hiredis/adapters/libevent.h" +#include "contrib/hiredis/adapters/libev.h" #include "cryptobox.h" #include "logger.h" @@ -44,7 +44,7 @@ struct rspamd_redis_pool_elt { }; struct rspamd_redis_pool { - struct event_base *ev_base; + struct ev_loop *event_loop; struct rspamd_config *cfg; GHashTable *elts_by_key; GHashTable *elts_by_ctx; @@ -205,7 +205,7 @@ rspamd_redis_pool_schedule_timeout (struct rspamd_redis_pool_connection *conn) conn->ctx, real_timeout); double_to_tv (real_timeout, &tv); event_set (&conn->timeout, -1, EV_TIMEOUT, rspamd_redis_conn_timeout, conn); - event_base_set (conn->elt->pool->ev_base, &conn->timeout); + event_base_set (conn->elt->pool->event_loop, &conn->timeout); event_add (&conn->timeout, &tv); } @@ -270,7 +270,7 @@ rspamd_redis_pool_new_connection (struct rspamd_redis_pool *pool, REF_INIT_RETAIN (conn, rspamd_redis_pool_conn_dtor); msg_debug_rpool ("created new connection to %s:%d: %p", ip, port, ctx); - redisLibeventAttach (ctx, pool->ev_base); + redisLibevAttach (pool->event_loop, ctx); redisAsyncSetDisconnectCallback (ctx, rspamd_redis_pool_on_disconnect, conn); @@ -317,11 +317,11 @@ rspamd_redis_pool_init (void) void rspamd_redis_pool_config (struct rspamd_redis_pool *pool, struct rspamd_config *cfg, - struct event_base *ev_base) + struct ev_loop *ev_base) { g_assert (pool != NULL); - pool->ev_base = ev_base; + pool->event_loop = ev_base; pool->cfg = cfg; pool->timeout = default_timeout; pool->max_conns = default_max_conns; @@ -339,7 +339,7 @@ rspamd_redis_pool_connect (struct rspamd_redis_pool *pool, struct rspamd_redis_pool_connection *conn; g_assert (pool != NULL); - g_assert (pool->ev_base != NULL); + g_assert (pool->event_loop != NULL); g_assert (ip != NULL); key = rspamd_redis_pool_get_key (db, password, ip, port); diff --git a/src/libserver/redis_pool.h b/src/libserver/redis_pool.h index a43b6d7e2..a881a0a38 100644 --- a/src/libserver/redis_pool.h +++ b/src/libserver/redis_pool.h @@ -21,7 +21,7 @@ struct rspamd_redis_pool; struct rspamd_config; struct redisAsyncContext; -struct event_base; +struct ev_loop; /** * Creates new redis pool @@ -36,7 +36,7 @@ struct rspamd_redis_pool *rspamd_redis_pool_init (void); */ void rspamd_redis_pool_config (struct rspamd_redis_pool *pool, struct rspamd_config *cfg, - struct event_base *ev_base); + struct ev_loop *ev_base); /** diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c index 12d37cdbc..9788d47ed 100644 --- a/src/libserver/rspamd_control.c +++ b/src/libserver/rspamd_control.c @@ -437,7 +437,7 @@ rspamd_control_broadcast_cmd (struct rspamd_main *rspamd_main, event_set (&rep_elt->io_ev, wrk->control_pipe[0], EV_READ | EV_PERSIST, handler, rep_elt); - event_base_set (rspamd_main->ev_base, + event_base_set (rspamd_main->event_loop, &rep_elt->io_ev); event_add (&rep_elt->io_ev, &worker_io_timeout); @@ -533,7 +533,7 @@ rspamd_control_process_client_socket (struct rspamd_main *rspamd_main, struct rspamd_worker_control_data { struct event io_ev; struct rspamd_worker *worker; - struct event_base *ev_base; + struct ev_loop *ev_base; struct { rspamd_worker_control_handler handler; gpointer ud; @@ -676,7 +676,7 @@ rspamd_control_default_worker_handler (gint fd, short what, gpointer ud) void rspamd_control_worker_add_default_handler (struct rspamd_worker *worker, - struct event_base *ev_base) + struct ev_loop *ev_base) { struct rspamd_worker_control_data *cd; @@ -974,7 +974,7 @@ rspamd_srv_handler (gint fd, short what, gpointer ud) void rspamd_srv_start_watching (struct rspamd_main *srv, struct rspamd_worker *worker, - struct event_base *ev_base) + struct ev_loop *ev_base) { g_assert (worker != NULL); @@ -1081,7 +1081,7 @@ cleanup: void rspamd_srv_send_command (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_srv_command *cmd, gint attached_fd, rspamd_srv_reply_handler handler, diff --git a/src/libserver/rspamd_control.h b/src/libserver/rspamd_control.h index ec3962c64..1928ab00f 100644 --- a/src/libserver/rspamd_control.h +++ b/src/libserver/rspamd_control.h @@ -18,7 +18,7 @@ #include "config.h" #include "mem_pool.h" -#include +#include "contrib/libev/ev.h" struct rspamd_main; struct rspamd_worker; @@ -199,7 +199,7 @@ void rspamd_control_process_client_socket (struct rspamd_main *rspamd_main, * Register default handlers for a worker */ void rspamd_control_worker_add_default_handler (struct rspamd_worker *worker, - struct event_base *ev_base); + struct ev_loop *ev_base); /** * Register custom handler for a specific control command for this worker @@ -214,7 +214,7 @@ void rspamd_control_worker_add_cmd_handler (struct rspamd_worker *worker, */ void rspamd_srv_start_watching (struct rspamd_main *srv, struct rspamd_worker *worker, - struct event_base *ev_base); + struct ev_loop *ev_base); /** @@ -222,7 +222,7 @@ void rspamd_srv_start_watching (struct rspamd_main *srv, * end */ void rspamd_srv_send_command (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_srv_command *cmd, gint attached_fd, rspamd_srv_reply_handler handler, diff --git a/src/libserver/rspamd_symcache.c b/src/libserver/rspamd_symcache.c index 5a4a002c3..43a916f3a 100644 --- a/src/libserver/rspamd_symcache.c +++ b/src/libserver/rspamd_symcache.c @@ -232,7 +232,7 @@ struct rspamd_cache_refresh_cbdata { struct event resort_ev; struct rspamd_symcache *cache; struct rspamd_worker *w; - struct event_base *ev_base; + struct ev_loop *ev_base; }; /* weight, frequency, time */ @@ -2173,14 +2173,14 @@ rspamd_symcache_counters (struct rspamd_symcache *cache) } static void -rspamd_symcache_call_peak_cb (struct event_base *ev_base, +rspamd_symcache_call_peak_cb (struct ev_loop *ev_base, struct rspamd_symcache *cache, struct rspamd_symcache_item *item, gdouble cur_value, gdouble cur_err) { lua_State *L = cache->cfg->lua_state; - struct event_base **pbase; + struct ev_loop **pbase; lua_rawgeti (L, LUA_REGISTRYINDEX, cache->peak_cb); pbase = lua_newuserdata (L, sizeof (*pbase)); @@ -2291,7 +2291,7 @@ rspamd_symcache_resort_cb (gint fd, short what, gpointer ud) void rspamd_symcache_start_refresh (struct rspamd_symcache *cache, - struct event_base *ev_base, struct rspamd_worker *w) + struct ev_loop *ev_base, struct rspamd_worker *w) { struct timeval tv; gdouble tm; diff --git a/src/libserver/rspamd_symcache.h b/src/libserver/rspamd_symcache.h index ef022b730..7bfb1d093 100644 --- a/src/libserver/rspamd_symcache.h +++ b/src/libserver/rspamd_symcache.h @@ -20,7 +20,7 @@ #include "ucl.h" #include "cfg_file.h" #include -#include +#include "contrib/libev/ev.h" struct rspamd_task; struct rspamd_config; @@ -198,7 +198,7 @@ ucl_object_t *rspamd_symcache_counters (struct rspamd_symcache *cache); * @param ev_base */ void rspamd_symcache_start_refresh (struct rspamd_symcache *cache, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_worker *w); /** diff --git a/src/libserver/task.c b/src/libserver/task.c index 16b33294e..62b8725c3 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -75,7 +75,7 @@ struct rspamd_task * rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg, rspamd_mempool_t *pool, struct rspamd_lang_detector *lang_det, - struct event_base *ev_base) + struct ev_loop *ev_base) { struct rspamd_task *new_task; @@ -101,7 +101,7 @@ rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg, } } - new_task->ev_base = ev_base; + new_task->event_loop = ev_base; #ifdef HAVE_EVENT_NO_CACHE_TIME_FUNC if (ev_base) { diff --git a/src/libserver/task.h b/src/libserver/task.h index 6aa1422bc..736644126 100644 --- a/src/libserver/task.h +++ b/src/libserver/task.h @@ -199,7 +199,7 @@ struct rspamd_task { void *fin_arg; /**< argument for fin callback */ struct rspamd_dns_resolver *resolver; /**< DNS resolver */ - struct event_base *ev_base; /**< Event base */ + struct ev_loop *event_loop; /**< Event base */ struct event timeout_ev; /**< Global task timeout */ struct event *guard_ev; /**< Event for input sanity guard */ @@ -220,7 +220,7 @@ struct rspamd_task *rspamd_task_new (struct rspamd_worker *worker, struct rspamd_config *cfg, rspamd_mempool_t *pool, struct rspamd_lang_detector *lang_det, - struct event_base *ev_base); + struct ev_loop *ev_base); /** * Destroy task object and remove its IO dispatcher if it exists */ diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c index a3601621f..59698be32 100644 --- a/src/libserver/worker_util.c +++ b/src/libserver/worker_util.c @@ -229,7 +229,7 @@ rspamd_sigh_free (void *p) void rspamd_worker_set_signal_handler (int signo, struct rspamd_worker *worker, - struct event_base *base, + struct ev_loop *base, rspamd_worker_signal_handler handler, void *handler_data) { @@ -261,7 +261,7 @@ rspamd_worker_set_signal_handler (int signo, struct rspamd_worker *worker, } void -rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base *base) +rspamd_worker_init_signals (struct rspamd_worker *worker, struct ev_loop *base) { struct sigaction signals; /* We ignore these signals in the worker */ @@ -297,11 +297,11 @@ rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base *bas sigprocmask (SIG_UNBLOCK, &signals.sa_mask, NULL); } -struct event_base * +struct ev_loop * rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, void (*accept_handler)(int, short, void *)) { - struct event_base *ev_base; + struct ev_loop *ev_base; struct event *accept_events; GList *cur; struct rspamd_worker_listen_socket *ls; @@ -633,7 +633,7 @@ struct rspamd_worker * rspamd_fork_worker (struct rspamd_main *rspamd_main, struct rspamd_worker_conf *cf, guint index, - struct event_base *ev_base) + struct ev_loop *ev_base) { struct rspamd_worker *wrk; gint rc; @@ -683,8 +683,8 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main, #endif /* Remove the inherited event base */ - event_reinit (rspamd_main->ev_base); - event_base_free (rspamd_main->ev_base); + event_reinit (rspamd_main->event_loop); + event_base_free (rspamd_main->event_loop); /* Drop privileges */ rspamd_worker_drop_priv (rspamd_main); @@ -867,7 +867,7 @@ struct rspamd_worker_session_elt { }; struct rspamd_worker_session_cache { - struct event_base *ev_base; + struct ev_loop *ev_base; GHashTable *cache; struct rspamd_config *cfg; struct timeval tv; @@ -923,7 +923,7 @@ rspamd_sessions_cache_periodic (gint fd, short what, gpointer p) void * rspamd_worker_session_cache_new (struct rspamd_worker *w, - struct event_base *ev_base) + struct ev_loop *ev_base) { struct rspamd_worker_session_cache *c; static const gdouble periodic_interval = 60.0; @@ -975,7 +975,7 @@ rspamd_worker_monitored_on_change (struct rspamd_monitored_ctx *ctx, { struct rspamd_worker *worker = ud; struct rspamd_config *cfg = worker->srv->cfg; - struct event_base *ev_base; + struct ev_loop *ev_base; guchar tag[RSPAMD_MONITORED_TAG_LEN]; static struct rspamd_srv_command srv_cmd; @@ -995,7 +995,7 @@ rspamd_worker_monitored_on_change (struct rspamd_monitored_ctx *ctx, void rspamd_worker_init_monitored (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver) { rspamd_monitored_ctx_config (worker->srv->cfg->monitored_ctx, diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h index 3186025b3..2dc78dfc7 100644 --- a/src/libserver/worker_util.h +++ b/src/libserver/worker_util.h @@ -35,7 +35,7 @@ struct rspamd_worker_signal_handler; * @param worker * @param base */ -void rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base *base); +void rspamd_worker_init_signals (struct rspamd_worker *worker, struct ev_loop *base); /** * Prepare worker's startup * @param worker worker structure @@ -44,7 +44,7 @@ void rspamd_worker_init_signals (struct rspamd_worker *worker, struct event_base * @param accept_handler handler of accept event for listen sockets * @return event base suitable for a worker */ -struct event_base * +struct ev_loop * rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, void (*accept_handler)(int, short, void *)); @@ -53,7 +53,7 @@ rspamd_prepare_worker (struct rspamd_worker *worker, const char *name, */ void rspamd_worker_set_signal_handler (int signo, struct rspamd_worker *worker, - struct event_base *base, + struct ev_loop *base, rspamd_worker_signal_handler handler, void *handler_data); @@ -162,7 +162,7 @@ gboolean rspamd_worker_is_primary_controller (struct rspamd_worker *w); * @return */ void * rspamd_worker_session_cache_new (struct rspamd_worker *w, - struct event_base *ev_base); + struct ev_loop *ev_base); /** * Adds a new session identified by pointer @@ -185,7 +185,7 @@ void rspamd_worker_session_cache_remove (void *cache, void *ptr); * Fork new worker with the specified configuration */ struct rspamd_worker *rspamd_fork_worker (struct rspamd_main *, - struct rspamd_worker_conf *, guint idx, struct event_base *ev_base); + struct rspamd_worker_conf *, guint idx, struct ev_loop *ev_base); /** * Sets crash signals handlers if compiled with libunwind @@ -199,7 +199,7 @@ void rspamd_set_crash_handler (struct rspamd_main *); * @param resolver */ void rspamd_worker_init_monitored (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver); #define msg_err_main(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \ diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c index 5976968a7..937327c7f 100644 --- a/src/libstat/backends/redis_backend.c +++ b/src/libstat/backends/redis_backend.c @@ -22,7 +22,7 @@ #ifdef WITH_HIREDIS #include "hiredis.h" -#include "adapters/libevent.h" +#include "adapters/libev.h" #include "ref.h" #define msg_debug_stat_redis(...) rspamd_conditional_debug_fast (NULL, NULL, \ @@ -87,7 +87,7 @@ struct rspamd_redis_stat_cbdata; struct rspamd_redis_stat_elt { struct redis_stat_ctx *ctx; struct rspamd_stat_async_elt *async; - struct event_base *ev_base; + struct ev_loop *event_loop; ucl_object_t *stat; struct rspamd_redis_stat_cbdata *cbdata; }; @@ -986,7 +986,7 @@ rspamd_redis_async_stat_cb (struct rspamd_stat_async_elt *elt, gpointer d) g_assert (cbdata->redis != NULL); - redisLibeventAttach (cbdata->redis, redis_elt->ev_base); + redisLibevAttach (redis_elt->event_loop, cbdata->redis); cbdata->inflight = 1; cbdata->cur = ucl_object_typed_new (UCL_OBJECT); @@ -1444,7 +1444,7 @@ rspamd_redis_init (struct rspamd_stat_ctx *ctx, backend->stcf = stf; st_elt = g_malloc0 (sizeof (*st_elt)); - st_elt->ev_base = ctx->ev_base; + st_elt->event_loop = ctx->ev_base; st_elt->ctx = backend; backend->stat_elt = rspamd_stat_ctx_register_async ( rspamd_redis_async_stat_cb, @@ -1536,7 +1536,7 @@ rspamd_redis_runtime (struct rspamd_task *task, return NULL; } - redisLibeventAttach (rt->redis, task->ev_base); + redisLibevAttach (task->event_loop, rt->redis); rspamd_redis_maybe_auth (ctx, rt->redis); return rt; @@ -1595,7 +1595,7 @@ rspamd_redis_process_tokens (struct rspamd_task *task, event_del (&rt->timeout_event); } event_set (&rt->timeout_event, -1, EV_TIMEOUT, rspamd_redis_timeout, rt); - event_base_set (task->ev_base, &rt->timeout_event); + event_base_set (task->event_loop, &rt->timeout_event); double_to_tv (rt->ctx->timeout, &tv); event_add (&rt->timeout_event, &tv); @@ -1704,7 +1704,7 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens, g_assert (rt->redis != NULL); - redisLibeventAttach (rt->redis, task->ev_base); + redisLibevAttach (task->event_loop, rt->redis); rspamd_redis_maybe_auth (rt->ctx, rt->redis); /* @@ -1806,7 +1806,7 @@ rspamd_redis_learn_tokens (struct rspamd_task *task, GPtrArray *tokens, event_del (&rt->timeout_event); } event_set (&rt->timeout_event, -1, EV_TIMEOUT, rspamd_redis_timeout, rt); - event_base_set (task->ev_base, &rt->timeout_event); + event_base_set (task->event_loop, &rt->timeout_event); double_to_tv (rt->ctx->timeout, &tv); event_add (&rt->timeout_event, &tv); diff --git a/src/libstat/classifiers/bayes.c b/src/libstat/classifiers/bayes.c index 2b0cf21e8..eca94156c 100644 --- a/src/libstat/classifiers/bayes.c +++ b/src/libstat/classifiers/bayes.c @@ -256,7 +256,7 @@ bayes_classify_token (struct rspamd_classifier *ctx, gboolean bayes_init (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_classifier *cl) { cl->cfg->flags |= RSPAMD_FLAG_CLASSIFIER_INTEGER; diff --git a/src/libstat/classifiers/classifiers.h b/src/libstat/classifiers/classifiers.h index fd6daf433..738a5e8c9 100644 --- a/src/libstat/classifiers/classifiers.h +++ b/src/libstat/classifiers/classifiers.h @@ -3,7 +3,7 @@ #include "config.h" #include "mem_pool.h" -#include +#include "contrib/libev/ev.h" #define RSPAMD_DEFAULT_CLASSIFIER "bayes" /* Consider this value as 0 */ @@ -19,7 +19,7 @@ struct token_node_s; struct rspamd_stat_classifier { char *name; gboolean (*init_func)(struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_classifier *cl); gboolean (*classify_func)(struct rspamd_classifier * ctx, GPtrArray *tokens, @@ -35,7 +35,7 @@ struct rspamd_stat_classifier { /* Bayes algorithm */ gboolean bayes_init (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_classifier *); gboolean bayes_classify (struct rspamd_classifier *ctx, GPtrArray *tokens, @@ -50,7 +50,7 @@ void bayes_fin (struct rspamd_classifier *); /* Generic lua classifier */ gboolean lua_classifier_init (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_classifier *); gboolean lua_classifier_classify (struct rspamd_classifier *ctx, GPtrArray *tokens, diff --git a/src/libstat/classifiers/lua_classifier.c b/src/libstat/classifiers/lua_classifier.c index 83ce7b0e1..21ecba7a1 100644 --- a/src/libstat/classifiers/lua_classifier.c +++ b/src/libstat/classifiers/lua_classifier.c @@ -48,7 +48,7 @@ INIT_LOG_MODULE(luacl) gboolean lua_classifier_init (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_classifier *cl) { struct rspamd_lua_classifier_ctx *ctx; diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index aea024e06..3ae30c440 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -21,7 +21,7 @@ #include "cryptobox.h" #include "ucl.h" #include "hiredis.h" -#include "adapters/libevent.h" +#include "adapters/libev.h" #include "lua/lua_common.h" #define REDIS_DEFAULT_TIMEOUT 0.5 @@ -398,11 +398,11 @@ rspamd_stat_cache_redis_runtime (struct rspamd_task *task, g_assert (rt->redis != NULL); - redisLibeventAttach (rt->redis, task->ev_base); + redisLibevAttach (task->event_loop, rt->redis); /* Now check stats */ event_set (&rt->timeout_event, -1, EV_TIMEOUT, rspamd_redis_cache_timeout, rt); - event_base_set (task->ev_base, &rt->timeout_event); + event_base_set (task->event_loop, &rt->timeout_event); rspamd_redis_cache_maybe_auth (ctx, rt->redis); if (!learn) { diff --git a/src/libstat/stat_api.h b/src/libstat/stat_api.h index f9d1aab5a..40a6bc716 100644 --- a/src/libstat/stat_api.h +++ b/src/libstat/stat_api.h @@ -19,7 +19,7 @@ #include "config.h" #include "task.h" #include -#include +#include "contrib/libev/ev.h" /** * @file stat_api.h @@ -76,7 +76,7 @@ typedef enum rspamd_stat_result_e { * Initialise statistics modules * @param cfg */ -void rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base); +void rspamd_stat_init (struct rspamd_config *cfg, struct ev_loop *ev_base); /** * Finalize statistics diff --git a/src/libstat/stat_config.c b/src/libstat/stat_config.c index 272a64ddf..1ad064c53 100644 --- a/src/libstat/stat_config.c +++ b/src/libstat/stat_config.c @@ -95,7 +95,7 @@ static struct rspamd_stat_cache stat_caches[] = { }; void -rspamd_stat_init (struct rspamd_config *cfg, struct event_base *ev_base) +rspamd_stat_init (struct rspamd_config *cfg, struct ev_loop *ev_base) { GList *cur, *curst; struct rspamd_classifier_config *clf; diff --git a/src/libstat/stat_internal.h b/src/libstat/stat_internal.h index a547ca93a..84c1de2be 100644 --- a/src/libstat/stat_internal.h +++ b/src/libstat/stat_internal.h @@ -93,7 +93,7 @@ struct rspamd_stat_ctx { struct rspamd_stat_tokenizer *tokenizer; gpointer tkcf; - struct event_base *ev_base; + struct ev_loop *ev_base; }; typedef enum rspamd_learn_cache_result { diff --git a/src/libutil/addr.c b/src/libutil/addr.c index 30a9ce66a..339f5facb 100644 --- a/src/libutil/addr.c +++ b/src/libutil/addr.c @@ -219,7 +219,7 @@ rspamd_disable_accept_events (gint sock, GList *accept_events) struct event *events; const gdouble throttling = 0.5; struct timeval tv; - struct event_base *ev_base; + struct ev_loop *ev_base; double_to_tv (throttling, &tv); diff --git a/src/libutil/aio_event.c b/src/libutil/aio_event.c index 584feb501..d0c8d3f63 100644 --- a/src/libutil/aio_event.c +++ b/src/libutil/aio_event.c @@ -14,7 +14,7 @@ * limitations under the License. */ #include "config.h" -#include +#include "contrib/libev/ev.h" #include "aio_event.h" #include "rspamd.h" #include "unix-std.h" @@ -177,7 +177,7 @@ eventfd (guint initval, guint flags) * AIO context */ struct aio_context { - struct event_base *base; + struct ev_loop *base; gboolean has_aio; /**< Whether we have aio support on a system */ #ifdef LINUX /* Eventfd variant */ @@ -251,7 +251,7 @@ rspamd_eventfdcb (gint fd, gshort what, gpointer ud) * Initialize aio with specified event base */ struct aio_context * -rspamd_aio_init (struct event_base *base) +rspamd_aio_init (struct ev_loop *base) { struct aio_context *new; diff --git a/src/libutil/aio_event.h b/src/libutil/aio_event.h index cccbed4e2..ededd96d4 100644 --- a/src/libutil/aio_event.h +++ b/src/libutil/aio_event.h @@ -32,7 +32,7 @@ typedef void (*rspamd_aio_cb) (gint fd, gint res, guint64 len, gpointer data, /** * Initialize aio with specified event base */ -struct aio_context * rspamd_aio_init (struct event_base *base); +struct aio_context * rspamd_aio_init (struct ev_loop *base); /** * Open file for aio diff --git a/src/libutil/http_connection.h b/src/libutil/http_connection.h index 6240772da..b4b401ecb 100644 --- a/src/libutil/http_connection.h +++ b/src/libutil/http_connection.h @@ -31,7 +31,7 @@ #include "http_util.h" #include "addr.h" -#include +#include "contrib/libev/ev.h" enum rspamd_http_connection_type { RSPAMD_HTTP_SERVER, diff --git a/src/libutil/http_context.c b/src/libutil/http_context.c index 95500aaad..b9add9ac9 100644 --- a/src/libutil/http_context.c +++ b/src/libutil/http_context.c @@ -87,7 +87,7 @@ rspamd_http_context_client_rotate_ev (gint fd, short what, void *arg) static struct rspamd_http_context* rspamd_http_context_new_default (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct upstream_ctx *ups_ctx) { struct rspamd_http_context *ctx; @@ -208,7 +208,7 @@ rspamd_http_context_init (struct rspamd_http_context *ctx) struct rspamd_http_context* rspamd_http_context_create (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct upstream_ctx *ups_ctx) { struct rspamd_http_context *ctx; @@ -337,7 +337,7 @@ rspamd_http_context_free (struct rspamd_http_context *ctx) struct rspamd_http_context* rspamd_http_context_create_config (struct rspamd_http_context_cfg *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct upstream_ctx *ups_ctx) { struct rspamd_http_context *ctx; @@ -498,7 +498,7 @@ void rspamd_http_context_push_keepalive (struct rspamd_http_context *ctx, struct rspamd_http_connection *conn, struct rspamd_http_message *msg, - struct event_base *ev_base) + struct ev_loop *ev_base) { struct rspamd_http_keepalive_cbdata *cbdata; struct timeval tv; diff --git a/src/libutil/http_context.h b/src/libutil/http_context.h index 4cf07fb48..c610ffbbd 100644 --- a/src/libutil/http_context.h +++ b/src/libutil/http_context.h @@ -21,7 +21,7 @@ #include "ucl.h" #include "addr.h" -#include +#include "contrib/libev/ev.h" struct rspamd_http_context; struct rspamd_config; @@ -45,11 +45,11 @@ struct rspamd_http_context_cfg { * @return new context used for both client and server HTTP connections */ struct rspamd_http_context* rspamd_http_context_create (struct rspamd_config *cfg, - struct event_base *ev_base, struct upstream_ctx *ctx); + struct ev_loop *ev_base, struct upstream_ctx *ctx); struct rspamd_http_context* rspamd_http_context_create_config ( struct rspamd_http_context_cfg *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct upstream_ctx *ctx); /** * Destroys context @@ -93,6 +93,6 @@ void rspamd_http_context_prepare_keepalive (struct rspamd_http_context *ctx, void rspamd_http_context_push_keepalive (struct rspamd_http_context *ctx, struct rspamd_http_connection *conn, struct rspamd_http_message *msg, - struct event_base *ev_base); + struct ev_loop *ev_base); #endif diff --git a/src/libutil/http_private.h b/src/libutil/http_private.h index 368715891..e29152c77 100644 --- a/src/libutil/http_private.h +++ b/src/libutil/http_private.h @@ -100,7 +100,7 @@ struct rspamd_http_context { struct upstream_list *http_proxies; gpointer ssl_ctx; gpointer ssl_ctx_noverify; - struct event_base *ev_base; + struct ev_loop *ev_base; struct event client_rotate_ev; khash_t (rspamd_keep_alive_hash) *keep_alive_hash; }; diff --git a/src/libutil/http_router.h b/src/libutil/http_router.h index 8e8056240..03886707a 100644 --- a/src/libutil/http_router.h +++ b/src/libutil/http_router.h @@ -46,7 +46,7 @@ struct rspamd_http_connection_router { GPtrArray *regexps; struct timeval tv; struct timeval *ptv; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_http_context *ctx; gchar *default_fs_path; rspamd_http_router_handler_t unknown_method_handler; diff --git a/src/libutil/map.c b/src/libutil/map.c index fc414ab00..82c668952 100644 --- a/src/libutil/map.c +++ b/src/libutil/map.c @@ -1893,7 +1893,7 @@ rspamd_map_periodic_callback (gint fd, short what, void *ud) /* Start watching event for all maps */ void rspamd_map_watch (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver, struct rspamd_worker *worker, gboolean active_http) diff --git a/src/libutil/map.h b/src/libutil/map.h index acf6eea4e..365f2cb4c 100644 --- a/src/libutil/map.h +++ b/src/libutil/map.h @@ -2,7 +2,7 @@ #define RSPAMD_MAP_H #include "config.h" -#include +#include "contrib/libev/ev.h" #include "ucl.h" #include "mem_pool.h" @@ -79,7 +79,7 @@ struct rspamd_map* rspamd_map_add_from_ucl (struct rspamd_config *cfg, * Start watching of maps by adding events to libevent event loop */ void rspamd_map_watch (struct rspamd_config *cfg, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver, struct rspamd_worker *worker, gboolean active_http); diff --git a/src/libutil/map_private.h b/src/libutil/map_private.h index b32f0e390..f7e0649e5 100644 --- a/src/libutil/map_private.h +++ b/src/libutil/map_private.h @@ -130,7 +130,7 @@ struct rspamd_map { map_fin_cb_t fin_callback; map_dtor_t dtor; void **user_data; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_worker *wrk; gchar *description; gchar *name; @@ -183,7 +183,7 @@ struct rspamd_http_file_data { }; struct http_callback_data { - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_http_connection *conn; rspamd_inet_addr_t *addr; struct rspamd_map *map; diff --git a/src/libutil/ssl_util.c b/src/libutil/ssl_util.c index 95245aa4c..b417efb74 100644 --- a/src/libutil/ssl_util.c +++ b/src/libutil/ssl_util.c @@ -46,7 +46,7 @@ struct rspamd_ssl_connection { SSL *ssl; gchar *hostname; struct event *ev; - struct event_base *ev_base; + struct ev_loop *ev_base; struct timeval *tv; rspamd_ssl_handler_t handler; rspamd_ssl_error_handler_t err_handler; @@ -480,7 +480,7 @@ rspamd_ssl_event_handler (gint fd, short what, gpointer ud) } struct rspamd_ssl_connection * -rspamd_ssl_connection_new (gpointer ssl_ctx, struct event_base *ev_base, +rspamd_ssl_connection_new (gpointer ssl_ctx, struct ev_loop *ev_base, gboolean verify_peer) { struct rspamd_ssl_connection *c; diff --git a/src/libutil/ssl_util.h b/src/libutil/ssl_util.h index 73a940e00..3bae1edc0 100644 --- a/src/libutil/ssl_util.h +++ b/src/libutil/ssl_util.h @@ -30,7 +30,7 @@ typedef void (*rspamd_ssl_error_handler_t)(gpointer d, GError *err); * @return opaque connection data */ struct rspamd_ssl_connection * rspamd_ssl_connection_new (gpointer ssl_ctx, - struct event_base *ev_base, gboolean verify_peer); + struct ev_loop *ev_base, gboolean verify_peer); /** * Connects SSL session using the specified (connected) FD diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 3e04e68e9..2a2934916 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -92,7 +92,7 @@ struct upstream_list { struct upstream_ctx { struct rdns_resolver *res; - struct event_base *ev_base; + struct ev_loop *ev_base; struct upstream_limits limits; GQueue *upstreams; gboolean configured; @@ -119,7 +119,7 @@ static guint default_dns_retransmits = 2; void rspamd_upstreams_library_config (struct rspamd_config *cfg, struct upstream_ctx *ctx, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rdns_resolver *resolver) { g_assert (ctx != NULL); diff --git a/src/libutil/upstream.h b/src/libutil/upstream.h index 75d840ce2..5fbec7ca1 100644 --- a/src/libutil/upstream.h +++ b/src/libutil/upstream.h @@ -41,7 +41,7 @@ void rspamd_upstreams_library_unref (struct upstream_ctx *ctx); * @param cfg */ void rspamd_upstreams_library_config (struct rspamd_config *cfg, - struct upstream_ctx *ctx, struct event_base *ev_base, + struct upstream_ctx *ctx, struct ev_loop *ev_base, struct rdns_resolver *resolver); /** diff --git a/src/libutil/util.c b/src/libutil/util.c index df10bf912..c5fec19a7 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2571,7 +2571,7 @@ rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len) } #if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000000UL -struct event_base * +struct ev_loop * event_get_base (struct event *ev) { return ev->ev_base; diff --git a/src/libutil/util.h b/src/libutil/util.h index 9d12285d4..75f391482 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -12,7 +12,7 @@ #include #endif -#include +#include "contrib/libev/ev.h" #include struct rspamd_config; @@ -426,15 +426,6 @@ void rspamd_random_seed_fast (void); */ gboolean rspamd_constant_memcmp (const guchar *a, const guchar *b, gsize len); -/* Special case for ancient libevent */ -#if !defined(LIBEVENT_VERSION_NUMBER) || LIBEVENT_VERSION_NUMBER < 0x02000000UL -struct event_base * event_get_base (struct event *ev); -#endif -/* CentOS libevent */ -#ifndef evsignal_set -#define evsignal_set(ev, x, cb, arg) \ - event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg)) -#endif /* Avoid stupidity in libevent > 1.4 */ int rspamd_event_pending (struct event *ev, short what); diff --git a/src/log_helper.c b/src/log_helper.c index 14a85c5b1..14b25fb37 100644 --- a/src/log_helper.c +++ b/src/log_helper.c @@ -49,7 +49,7 @@ static const guint64 rspamd_log_helper_magic = 0x1090bb46aaa74c9aULL; struct log_helper_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ @@ -87,7 +87,7 @@ rspamd_log_helper_read (gint fd, short what, gpointer ud) struct rspamd_protocol_log_message_sum *sm; struct rspamd_worker_lua_script *sc; struct rspamd_config **pcfg; - struct event_base **pevbase; + struct ev_loop **pevbase; r = read (fd, buf, sizeof (buf)); diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c index e268d6564..5f31ebbb0 100644 --- a/src/lua/lua_common.c +++ b/src/lua/lua_common.c @@ -1828,23 +1828,23 @@ lua_check_session (lua_State * L, gint pos) return ud ? *((struct rspamd_async_session **)ud) : NULL; } -struct event_base* +struct ev_loop* lua_check_ev_base (lua_State * L, gint pos) { void *ud = rspamd_lua_check_udata (L, pos, "rspamd{ev_base}"); luaL_argcheck (L, ud != NULL, pos, "'event_base' expected"); - return ud ? *((struct event_base **)ud) : NULL; + return ud ? *((struct ev_loop **)ud) : NULL; } static void rspamd_lua_run_postloads_error (struct thread_entry *thread, int ret, const char *msg); void rspamd_lua_run_postloads (lua_State *L, struct rspamd_config *cfg, - struct event_base *ev_base, struct rspamd_worker *w) + struct ev_loop *ev_base, struct rspamd_worker *w) { struct rspamd_config_cfg_lua_script *sc; struct rspamd_config **pcfg; - struct event_base **pev_base; + struct ev_loop **pev_base; struct rspamd_worker **pw; /* Execute post load scripts */ diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index ea07d7717..f3d006743 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -317,7 +317,7 @@ void rspamd_lua_set_globals (struct rspamd_config *cfg, lua_State *L); struct memory_pool_s * rspamd_lua_check_mempool (lua_State * L, gint pos); struct rspamd_config * lua_check_config (lua_State * L, gint pos); struct rspamd_async_session* lua_check_session (lua_State * L, gint pos); -struct event_base* lua_check_ev_base (lua_State * L, gint pos); +struct ev_loop* lua_check_ev_base (lua_State * L, gint pos); struct rspamd_dns_resolver * lua_check_dns_resolver (lua_State * L, gint pos); /** @@ -420,7 +420,7 @@ void lua_call_finish_script (struct rspamd_config_cfg_lua_script *sc, * @param ev_base */ void rspamd_lua_run_postloads (lua_State *L, struct rspamd_config *cfg, - struct event_base *ev_base, struct rspamd_worker *w); + struct ev_loop *ev_base, struct rspamd_worker *w); void rspamd_lua_run_config_post_init (lua_State *L, struct rspamd_config *cfg); void rspamd_lua_run_config_unload (lua_State *L, struct rspamd_config *cfg); diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 27a2e32a8..196f12e2c 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -3050,7 +3050,7 @@ static void lua_periodic_callback_finish (struct thread_entry *thread, int ret); static void lua_periodic_callback_error (struct thread_entry *thread, int ret, const char *msg); struct rspamd_lua_periodic { - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_config *cfg; lua_State *L; gdouble timeout; @@ -3064,7 +3064,7 @@ lua_periodic_callback (gint unused_fd, short what, gpointer ud) { struct rspamd_lua_periodic *periodic = ud; struct rspamd_config **pcfg, *cfg; - struct event_base **pev_base; + struct ev_loop **pev_base; struct thread_entry *thread; lua_State *L; @@ -3147,7 +3147,7 @@ lua_config_add_periodic (lua_State *L) { LUA_TRACE_POINT; struct rspamd_config *cfg = lua_check_config (L, 1); - struct event_base *ev_base = lua_check_ev_base (L, 2); + struct ev_loop *ev_base = lua_check_ev_base (L, 2); gdouble timeout = lua_tonumber (L, 3); struct timeval tv; struct rspamd_lua_periodic *periodic; @@ -3961,7 +3961,7 @@ lua_config_init_subsystem (lua_State *L) rspamd_stat_init (cfg, NULL); } else if (strcmp (parts[i], "dns") == 0) { - struct event_base *ev_base = lua_check_ev_base (L, 3); + struct ev_loop *ev_base = lua_check_ev_base (L, 3); if (ev_base) { cfg->dns_resolver = rspamd_dns_resolver_init (rspamd_logger_get_singleton (), diff --git a/src/lua/lua_dns_resolver.c b/src/lua/lua_dns_resolver.c index 56b6989c0..382e9e985 100644 --- a/src/lua/lua_dns_resolver.c +++ b/src/lua/lua_dns_resolver.c @@ -313,7 +313,7 @@ lua_dns_resolver_init (lua_State *L) { struct rspamd_dns_resolver *resolver, **presolver; struct rspamd_config *cfg, **pcfg; - struct event_base *base, **pbase; + struct ev_loop *base, **pbase; /* Check args */ pbase = rspamd_lua_check_udata (L, 1, "rspamd{ev_base}"); diff --git a/src/lua/lua_fann.c b/src/lua/lua_fann.c index 40353ea40..7eb493740 100644 --- a/src/lua/lua_fann.c +++ b/src/lua/lua_fann.c @@ -689,7 +689,7 @@ lua_fann_train_threaded (lua_State *L) struct fann *f = rspamd_lua_check_fann (L, 1); guint ninputs, noutputs, ndata, i, j; struct lua_fann_train_cbdata *cbdata; - struct event_base *ev_base = lua_check_ev_base (L, 5); + struct ev_loop *ev_base = lua_check_ev_base (L, 5); GError *err = NULL; const guint max_epochs_default = 1000; const gdouble desired_mse_default = 0.0001; diff --git a/src/lua/lua_http.c b/src/lua/lua_http.c index 46d5ed412..38072e177 100644 --- a/src/lua/lua_http.c +++ b/src/lua/lua_http.c @@ -67,7 +67,7 @@ struct lua_http_cbdata { struct rspamd_async_session *session; struct rspamd_symcache_item *item; struct rspamd_http_message *msg; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_config *cfg; struct rspamd_task *task; struct timeval tv; @@ -89,7 +89,7 @@ struct lua_http_cbdata { static const int default_http_timeout = 5000; static struct rspamd_dns_resolver * -lua_http_global_resolver (struct event_base *ev_base) +lua_http_global_resolver (struct ev_loop *ev_base) { static struct rspamd_dns_resolver *global_resolver; @@ -562,7 +562,7 @@ static gint lua_http_request (lua_State *L) { LUA_TRACE_POINT; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_http_message *msg; struct lua_http_cbdata *cbd; struct rspamd_dns_resolver *resolver; @@ -597,7 +597,7 @@ lua_http_request (lua_State *L) cbref = luaL_ref (L, LUA_REGISTRYINDEX); if (lua_gettop (L) >= 3 && rspamd_lua_check_udata_maybe (L, 3, "rspamd{ev_base}")) { - ev_base = *(struct event_base **)lua_touserdata (L, 3); + ev_base = *(struct ev_loop **)lua_touserdata (L, 3); } else { ev_base = NULL; @@ -643,7 +643,7 @@ lua_http_request (lua_State *L) if (lua_type (L, -1) == LUA_TUSERDATA) { task = lua_check_task (L, -1); - ev_base = task->ev_base; + ev_base = task->event_loop; resolver = task->resolver; session = task->s; cfg = task->cfg; @@ -654,7 +654,7 @@ lua_http_request (lua_State *L) lua_pushstring (L, "ev_base"); lua_gettable (L, 1); if (rspamd_lua_check_udata_maybe (L, -1, "rspamd{ev_base}")) { - ev_base = *(struct event_base **)lua_touserdata (L, -1); + ev_base = *(struct ev_loop **)lua_touserdata (L, -1); } else { ev_base = NULL; diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c index 4335a3467..b96171d89 100644 --- a/src/lua/lua_redis.c +++ b/src/lua/lua_redis.c @@ -98,7 +98,7 @@ struct lua_redis_userdata { struct rspamd_task *task; struct rspamd_symcache_item *item; struct rspamd_async_session *s; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_config *cfg; struct rspamd_redis_pool *pool; gchar *server; @@ -800,7 +800,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref, gboolean is_asy gint cbref = -1; struct rspamd_config *cfg = NULL; struct rspamd_async_session *session = NULL; - struct event_base *ev_base = NULL; + struct ev_loop *ev_base = NULL; gboolean ret = FALSE; guint flags = 0; @@ -850,7 +850,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref, gboolean is_asy else { cfg = task->cfg; session = task->s; - ev_base = task->ev_base; + ev_base = task->event_loop; ret = TRUE; } diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index d1abe6a2b..11ee6b32a 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1523,7 +1523,7 @@ lua_task_create (lua_State * L) LUA_TRACE_POINT; struct rspamd_task *task = NULL, **ptask; struct rspamd_config *cfg = NULL; - struct event_base *ev_base = NULL; + struct ev_loop *ev_base = NULL; if (lua_type (L, 1) == LUA_TUSERDATA) { gpointer p; @@ -1539,7 +1539,7 @@ lua_task_create (lua_State * L) p = rspamd_lua_check_udata_maybe (L, 2, "rspamd{ev_base}"); if (p) { - ev_base = *(struct event_base **)p; + ev_base = *(struct ev_loop **)p; } } @@ -1610,13 +1610,13 @@ static int lua_task_get_ev_base (lua_State * L) { LUA_TRACE_POINT; - struct event_base **pbase; + struct ev_loop **pbase; struct rspamd_task *task = lua_check_task (L, 1); if (task != NULL) { - pbase = lua_newuserdata (L, sizeof (struct event_base *)); + pbase = lua_newuserdata (L, sizeof (struct ev_loop *)); rspamd_lua_setclass (L, "rspamd{ev_base}", -1); - *pbase = task->ev_base; + *pbase = task->event_loop; } else { return luaL_error (L, "invalid arguments"); diff --git a/src/lua/lua_tcp.c b/src/lua/lua_tcp.c index d0def9ac2..cad0e6556 100644 --- a/src/lua/lua_tcp.c +++ b/src/lua/lua_tcp.c @@ -342,7 +342,7 @@ struct lua_tcp_dtor { struct lua_tcp_cbdata { struct rspamd_async_session *session; struct rspamd_async_event *async_ev; - struct event_base *ev_base; + struct ev_loop *ev_base; struct timeval tv; rspamd_inet_addr_t *addr; GByteArray *in; @@ -384,7 +384,7 @@ lua_tcp_void_finalyser (gpointer arg) {} static const int default_tcp_timeout = 5000; static struct rspamd_dns_resolver * -lua_tcp_global_resolver (struct event_base *ev_base, +lua_tcp_global_resolver (struct ev_loop *ev_base, struct rspamd_config *cfg) { static struct rspamd_dns_resolver *global_resolver; @@ -1431,7 +1431,7 @@ lua_tcp_request (lua_State *L) guint port; gint cbref, tp, conn_cbref = -1; gsize plen = 0; - struct event_base *ev_base; + struct ev_loop *ev_base; struct lua_tcp_cbdata *cbd; struct rspamd_dns_resolver *resolver = NULL; struct rspamd_async_session *session = NULL; @@ -1478,7 +1478,7 @@ lua_tcp_request (lua_State *L) lua_gettable (L, -2); if (lua_type (L, -1) == LUA_TUSERDATA) { task = lua_check_task (L, -1); - ev_base = task->ev_base; + ev_base = task->event_loop; resolver = task->resolver; session = task->s; cfg = task->cfg; @@ -1489,7 +1489,7 @@ lua_tcp_request (lua_State *L) lua_pushstring (L, "ev_base"); lua_gettable (L, -2); if (rspamd_lua_check_udata_maybe (L, -1, "rspamd{ev_base}")) { - ev_base = *(struct event_base **)lua_touserdata (L, -1); + ev_base = *(struct ev_loop **)lua_touserdata (L, -1); } else { ev_base = NULL; @@ -1825,7 +1825,7 @@ lua_tcp_connect_sync (lua_State *L) struct rspamd_async_session *session = NULL; struct rspamd_dns_resolver *resolver = NULL; struct rspamd_config *cfg = NULL; - struct event_base *ev_base = NULL; + struct ev_loop *ev_base = NULL; int arguments_validated = rspamd_lua_parse_table_arguments (L, 1, &err, "task=U{task};session=U{session};resolver=U{resolver};ev_base=U{ev_base};" @@ -1859,7 +1859,7 @@ lua_tcp_connect_sync (lua_State *L) if (task) { cfg = task->cfg; - ev_base = task->ev_base; + ev_base = task->event_loop; session = task->s; } if (resolver == NULL) { diff --git a/src/lua/lua_udp.c b/src/lua/lua_udp.c index 8a862f16a..fdbc0f36d 100644 --- a/src/lua/lua_udp.c +++ b/src/lua/lua_udp.c @@ -61,7 +61,7 @@ static const struct luaL_reg udp_libf[] = { struct lua_udp_cbdata { struct event io; struct timeval tv; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_async_event *async_ev; struct rspamd_task *task; rspamd_mempool_t *pool; @@ -358,7 +358,7 @@ lua_udp_sendto (lua_State *L) { LUA_TRACE_POINT; const gchar *host; guint port; - struct event_base *ev_base = NULL; + struct ev_loop *ev_base = NULL; struct lua_udp_cbdata *cbd; struct rspamd_async_session *session = NULL; struct rspamd_task *task = NULL; @@ -423,7 +423,7 @@ lua_udp_sendto (lua_State *L) { lua_gettable (L, -2); if (lua_type (L, -1) == LUA_TUSERDATA) { task = lua_check_task (L, -1); - ev_base = task->ev_base; + ev_base = task->event_loop; session = task->s; pool = task->task_pool; } @@ -433,7 +433,7 @@ lua_udp_sendto (lua_State *L) { lua_pushstring (L, "ev_base"); lua_gettable (L, -2); if (rspamd_lua_check_udata_maybe (L, -1, "rspamd{ev_base}")) { - ev_base = *(struct event_base **) lua_touserdata (L, -1); + ev_base = *(struct ev_loop **) lua_touserdata (L, -1); } else { ev_base = NULL; } diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c index e6241b48d..8ef0bc2fb 100644 --- a/src/lua/lua_util.c +++ b/src/lua/lua_util.c @@ -695,9 +695,9 @@ static gint lua_util_create_event_base (lua_State *L) { LUA_TRACE_POINT; - struct event_base **pev_base; + struct ev_loop **pev_base; - pev_base = lua_newuserdata (L, sizeof (struct event_base *)); + pev_base = lua_newuserdata (L, sizeof (struct ev_loop *)); rspamd_lua_setclass (L, "rspamd{ev_base}", -1); *pev_base = event_init (); @@ -842,7 +842,7 @@ lua_util_process_message (lua_State *L) const gchar *message; gsize mlen; struct rspamd_task *task; - struct event_base *base; + struct ev_loop *base; ucl_object_t *res = NULL; message = luaL_checklstring (L, 2, &mlen); @@ -3795,7 +3795,7 @@ static int lua_ev_base_loop (lua_State *L) { int flags = 0; - struct event_base *ev_base; + struct ev_loop *ev_base; ev_base = lua_check_ev_base (L, 1); if (lua_isnumber (L, 2)) { diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c index 332d7e663..d876d0879 100644 --- a/src/lua/lua_worker.c +++ b/src/lua/lua_worker.c @@ -282,7 +282,7 @@ struct rspamd_lua_process_cbdata { GString *out_buf; goffset out_pos; struct rspamd_worker *wrk; - struct event_base *ev_base; + struct ev_loop *ev_base; struct event ev; }; diff --git a/src/lua_worker.c b/src/lua_worker.c index df76945ea..1c5fa19df 100644 --- a/src/lua_worker.c +++ b/src/lua_worker.c @@ -54,7 +54,7 @@ static const guint64 rspamd_lua_ctx_magic = 0x8055e2652aacf96eULL; struct rspamd_lua_worker_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ @@ -117,10 +117,10 @@ static int lua_worker_get_ev_base (lua_State *L) { struct rspamd_lua_worker_ctx *ctx = lua_check_lua_worker (L); - struct event_base **pbase; + struct ev_loop **pbase; if (ctx) { - pbase = lua_newuserdata (L, sizeof (struct event_base *)); + pbase = lua_newuserdata (L, sizeof (struct ev_loop *)); rspamd_lua_setclass (L, "rspamd{ev_base}", -1); *pbase = ctx->ev_base; } diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 639b0edf8..ed5bc9132 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -2187,7 +2187,7 @@ fuzzy_check_io_callback (gint fd, short what, void *arg) { struct fuzzy_client_session *session = arg; struct rspamd_task *task; - struct event_base *ev_base; + struct ev_loop *ev_base; gint r; enum { @@ -2274,7 +2274,7 @@ fuzzy_check_timer_callback (gint fd, short what, void *arg) { struct fuzzy_client_session *session = arg; struct rspamd_task *task; - struct event_base *ev_base; + struct ev_loop *ev_base; task = session->task; @@ -2340,7 +2340,7 @@ fuzzy_controller_io_callback (gint fd, short what, void *arg) struct fuzzy_cmd_io *io; struct rspamd_fuzzy_cmd *cmd = NULL; const gchar *symbol, *ftype; - struct event_base *ev_base; + struct ev_loop *ev_base; gint r; enum { return_error = 0, @@ -2593,7 +2593,7 @@ fuzzy_controller_timer_callback (gint fd, short what, void *arg) { struct fuzzy_learn_session *session = arg; struct rspamd_task *task; - struct event_base *ev_base; + struct ev_loop *ev_base; task = session->task; @@ -2785,12 +2785,12 @@ register_fuzzy_client_call (struct rspamd_task *task, event_set (&session->ev, sock, EV_WRITE, fuzzy_check_io_callback, session); - event_base_set (session->task->ev_base, &session->ev); + event_base_set (session->task->event_loop, &session->ev); event_add (&session->ev, NULL); evtimer_set (&session->timev, fuzzy_check_timer_callback, session); - event_base_set (session->task->ev_base, &session->timev); + event_base_set (session->task->event_loop, &session->timev); event_add (&session->timev, &session->tv); rspamd_session_add_event (task->s, fuzzy_io_fin, session, M); @@ -2917,7 +2917,7 @@ register_fuzzy_controller_call (struct rspamd_http_connection_entry *entry, evtimer_set (&s->timev, fuzzy_controller_timer_callback, s); - event_base_set (s->task->ev_base, &s->timev); + event_base_set (s->task->event_loop, &s->timev); event_add (&s->timev, &s->tv); (*saved)++; @@ -3271,11 +3271,11 @@ fuzzy_check_send_lua_learn (struct fuzzy_rule *rule, s->session = task->s; event_set (&s->ev, sock, EV_WRITE, fuzzy_controller_io_callback, s); - event_base_set (task->ev_base, &s->ev); + event_base_set (task->event_loop, &s->ev); event_add (&s->ev, NULL); evtimer_set (&s->timev, fuzzy_controller_timer_callback, s); - event_base_set (s->task->ev_base, &s->timev); + event_base_set (s->task->event_loop, &s->timev); event_add (&s->timev, &s->tv); rspamd_session_add_event (task->s, diff --git a/src/rspamadm/control.c b/src/rspamadm/control.c index 1311622c3..8a42bdac1 100644 --- a/src/rspamadm/control.c +++ b/src/rspamadm/control.c @@ -21,7 +21,7 @@ #include "libutil/http_private.h" #include "addr.h" #include "unix-std.h" -#include +#include "contrib/libev/ev.h" #include "libutil/util.h" #include "lua/lua_common.h" @@ -159,7 +159,7 @@ rspamd_control_finish_handler (struct rspamd_http_connection *conn, end: exit_tv.tv_sec = 0; exit_tv.tv_usec = 0; - event_base_loopexit (rspamd_main->ev_base, &exit_tv); + event_base_loopexit (rspamd_main->event_loop, &exit_tv); return 0; } @@ -248,7 +248,7 @@ rspamadm_control (gint argc, gchar **argv, const struct rspamadm_command *_cmd) rspamd_http_connection_write_message (conn, msg, NULL, NULL, &cbdata, &tv); - event_base_loop (rspamd_main->ev_base, 0); + event_base_loop (rspamd_main->event_loop, 0); rspamd_http_connection_unref (conn); rspamd_inet_address_free (addr); diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c index 43c97d01f..33805d66b 100644 --- a/src/rspamadm/lua_repl.c +++ b/src/rspamadm/lua_repl.c @@ -296,7 +296,7 @@ wait_session_events (void) { /* XXX: it's probably worth to add timeout here - not to wait forever */ while (rspamd_session_events_pending (rspamadm_session) > 0) { - event_base_loop (rspamd_main->ev_base, EVLOOP_ONCE); + event_base_loop (rspamd_main->event_loop, EVLOOP_ONCE); } } @@ -793,7 +793,7 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd) /* HTTP Server mode */ GPtrArray *addrs = NULL; gchar *name = NULL; - struct event_base *ev_base; + struct ev_loop *ev_base; struct rspamd_http_connection_router *http; gint fd; struct rspamadm_lua_repl_context *ctx; @@ -804,7 +804,7 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd) exit (EXIT_FAILURE); } - ev_base = rspamd_main->ev_base; + ev_base = rspamd_main->event_loop; ctx = g_malloc0 (sizeof (*ctx)); http = rspamd_http_router_new (rspamadm_lua_error_handler, rspamadm_lua_finish_handler, diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c index 8096649f9..4320c2460 100644 --- a/src/rspamadm/rspamadm.c +++ b/src/rspamadm/rspamadm.c @@ -329,7 +329,7 @@ static void rspamadm_add_lua_globals (struct rspamd_dns_resolver *resolver) { struct rspamd_async_session **psession; - struct event_base **pev_base; + struct ev_loop **pev_base; struct rspamd_dns_resolver **presolver; rspamadm_session = rspamd_session_create (rspamd_main->cfg->cfg_pool, NULL, @@ -340,9 +340,9 @@ rspamadm_add_lua_globals (struct rspamd_dns_resolver *resolver) *psession = rspamadm_session; lua_setglobal (L, "rspamadm_session"); - pev_base = lua_newuserdata (L, sizeof (struct event_base *)); + pev_base = lua_newuserdata (L, sizeof (struct ev_loop *)); rspamd_lua_setclass (L, "rspamd{ev_base}", -1); - *pev_base = rspamd_main->ev_base; + *pev_base = rspamd_main->event_loop; lua_setglobal (L, "rspamadm_ev_base"); presolver = lua_newuserdata (L, sizeof (struct rspamd_dns_resolver *)); @@ -385,7 +385,7 @@ main (gint argc, gchar **argv, gchar **env) event_config_set_flag (ev_cfg, EVENT_BASE_FLAG_NO_CACHE_TIME); rspamd_main->ev_base = event_base_new_with_config (ev_cfg); #else - rspamd_main->ev_base = event_init (); + rspamd_main->event_loop = event_init (); #endif rspamadm_fill_internal_commands (all_commands); @@ -444,9 +444,9 @@ main (gint argc, gchar **argv, gchar **env) (void) rspamd_log_open (rspamd_main->logger); resolver = rspamd_dns_resolver_init (rspamd_main->logger, - rspamd_main->ev_base, + rspamd_main->event_loop, cfg); - rspamd_main->http_ctx = rspamd_http_context_create (cfg, rspamd_main->ev_base, + rspamd_main->http_ctx = rspamd_http_context_create (cfg, rspamd_main->event_loop, NULL); g_log_set_default_handler (rspamd_glib_log_function, rspamd_main->logger); @@ -481,7 +481,7 @@ main (gint argc, gchar **argv, gchar **env) rspamadm_add_lua_globals (resolver); #ifdef WITH_HIREDIS - rspamd_redis_pool_config (cfg->redis_pool, cfg, rspamd_main->ev_base); + rspamd_redis_pool_config (cfg->redis_pool, cfg, rspamd_main->event_loop); #endif /* Init rspamadm global */ @@ -565,7 +565,7 @@ main (gint argc, gchar **argv, gchar **env) cmd->run (0, NULL, cmd); } - event_base_loopexit (rspamd_main->ev_base, NULL); + event_base_loopexit (rspamd_main->event_loop, NULL); #ifdef HAVE_EVENT_NO_CACHE_TIME_FLAG event_config_free (ev_cfg); #endif diff --git a/src/rspamd.c b/src/rspamd.c index 8b12fa48e..685793ee8 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -370,7 +370,7 @@ rspamd_fork_delayed_cb (gint signo, short what, gpointer arg) event_del (&w->wait_ev); rspamd_fork_worker (w->rspamd_main, w->cf, w->oldindex, - w->rspamd_main->ev_base); + w->rspamd_main->event_loop); REF_RELEASE (w->cf); g_free (w); } @@ -391,7 +391,7 @@ rspamd_fork_delayed (struct rspamd_worker_conf *cf, tv.tv_usec = 0; REF_RETAIN (cf); event_set (&nw->wait_ev, -1, EV_TIMEOUT, rspamd_fork_delayed_cb, nw); - event_base_set (rspamd_main->ev_base, &nw->wait_ev); + event_base_set (rspamd_main->event_loop, &nw->wait_ev); event_add (&nw->wait_ev, &tv); } @@ -552,7 +552,7 @@ make_listen_key (struct rspamd_worker_bind_conf *cf) } static void -spawn_worker_type (struct rspamd_main *rspamd_main, struct event_base *ev_base, +spawn_worker_type (struct rspamd_main *rspamd_main, struct ev_loop *ev_base, struct rspamd_worker_conf *cf) { gint i; @@ -582,7 +582,7 @@ spawn_worker_type (struct rspamd_main *rspamd_main, struct event_base *ev_base, } static void -spawn_workers (struct rspamd_main *rspamd_main, struct event_base *ev_base) +spawn_workers (struct rspamd_main *rspamd_main, struct ev_loop *ev_base) { GList *cur, *ls; struct rspamd_worker_conf *cf; @@ -992,7 +992,7 @@ rspamd_term_handler (gint signo, short what, gpointer arg) rspamd_log_nolock (rspamd_main->logger); rspamd_pass_signal (rspamd_main->workers, signo); - event_base_loopexit (rspamd_main->ev_base, NULL); + event_base_loopexit (rspamd_main->event_loop, NULL); } static void @@ -1022,7 +1022,7 @@ rspamd_hup_handler (gint signo, short what, gpointer arg) rspamd_main->workers_gid); reread_config (rspamd_main); rspamd_check_core_limits (rspamd_main); - spawn_workers (rspamd_main, rspamd_main->ev_base); + spawn_workers (rspamd_main, rspamd_main->event_loop); } static void @@ -1175,7 +1175,7 @@ rspamd_final_term_handler (gint signo, short what, gpointer arg) g_hash_table_foreach_remove (rspamd_main->workers, wait_for_workers, NULL); if (g_hash_table_size (rspamd_main->workers) == 0) { - event_base_loopexit (rspamd_main->ev_base, NULL); + event_base_loopexit (rspamd_main->event_loop, NULL); } } @@ -1243,7 +1243,7 @@ main (gint argc, gchar **argv, gchar **env) worker_t **pworker; GQuark type; rspamd_inet_addr_t *control_addr = NULL; - struct event_base *ev_base; + struct ev_loop *ev_base; struct event term_ev, int_ev, cld_ev, hup_ev, usr1_ev, control_ev; struct timeval term_tv; struct rspamd_main *rspamd_main; @@ -1499,7 +1499,7 @@ main (gint argc, gchar **argv, gchar **env) /* Init event base */ ev_base = event_init (); - rspamd_main->ev_base = ev_base; + rspamd_main->event_loop = ev_base; /* Unblock signals */ sigemptyset (&signals.sa_mask); sigprocmask (SIG_SETMASK, &signals.sa_mask, NULL); diff --git a/src/rspamd.h b/src/rspamd.h index 09f401b38..9af78e904 100644 --- a/src/rspamd.h +++ b/src/rspamd.h @@ -94,7 +94,7 @@ struct rspamd_worker { struct rspamd_abstract_worker_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ @@ -116,7 +116,7 @@ struct rspamd_worker_signal_handler { gint signo; gboolean enabled; struct event ev; - struct event_base *base; + struct ev_loop *base; struct rspamd_worker *worker; struct rspamd_worker_signal_cb *cb; }; @@ -276,7 +276,7 @@ struct rspamd_main { gboolean is_privilleged; /**< true if run in privilleged mode */ gboolean cores_throttling; /**< turn off cores when limits are exceeded */ struct roll_history *history; /**< rolling history */ - struct event_base *ev_base; + struct ev_loop *event_loop; struct rspamd_http_context *http_ctx; }; @@ -311,7 +311,7 @@ struct controller_session { GList *parts; /**< extracted mime parts */ struct rspamd_async_session * s; /**< async session object */ struct rspamd_dns_resolver *resolver; /**< DNS resolver */ - struct event_base *ev_base; /**< Event base */ + struct ev_loop *ev_base; /**< Event base */ }; struct zstd_dictionary { diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c index deba18dab..5907a7ba4 100644 --- a/src/rspamd_proxy.c +++ b/src/rspamd_proxy.c @@ -113,7 +113,7 @@ static const guint64 rspamd_rspamd_proxy_magic = 0xcdeb4fd1fc351980ULL; struct rspamd_proxy_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ diff --git a/src/worker.c b/src/worker.c index 5a01c6bd3..a202d0917 100644 --- a/src/worker.c +++ b/src/worker.c @@ -77,7 +77,7 @@ rspamd_worker_finalize (gpointer user_data) if (!(task->flags & RSPAMD_TASK_FLAG_PROCESSING)) { msg_info_task ("finishing actions has been processed, terminating"); - event_base_loopexit (task->ev_base, &tv); + event_base_loopexit (task->event_loop, &tv); rspamd_session_destroy (task->s); return TRUE; @@ -284,7 +284,7 @@ rspamd_worker_body_handler (struct rspamd_http_connection *conn, event_set (guard_ev, task->sock, EV_READ|EV_PERSIST, rspamd_worker_guard_handler, task); #endif - event_base_set (task->ev_base, guard_ev); + event_base_set (task->event_loop, guard_ev); event_add (guard_ev, NULL); task->guard_ev = guard_ev; @@ -638,7 +638,7 @@ rspamd_worker_on_terminate (struct rspamd_worker *worker) void rspamd_worker_init_scanner (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver, struct rspamd_lang_detector **plang_det) { diff --git a/src/worker_private.h b/src/worker_private.h index 398c5d23d..35a2b465b 100644 --- a/src/worker_private.h +++ b/src/worker_private.h @@ -30,7 +30,7 @@ struct rspamd_lang_detector; struct rspamd_worker_ctx { guint64 magic; /* Events base */ - struct event_base *ev_base; + struct ev_loop *ev_base; /* DNS resolver */ struct rspamd_dns_resolver *resolver; /* Config */ @@ -57,7 +57,7 @@ struct rspamd_worker_ctx { * Init scanning routines */ void rspamd_worker_init_scanner (struct rspamd_worker *worker, - struct event_base *ev_base, + struct ev_loop *ev_base, struct rspamd_dns_resolver *resolver, struct rspamd_lang_detector **plang_det); diff --git a/test/rspamd_async_test.c b/test/rspamd_async_test.c index 5ac71a4da..122cca9c5 100644 --- a/test/rspamd_async_test.c +++ b/test/rspamd_async_test.c @@ -18,7 +18,7 @@ #include "aio_event.h" #include "unix-std.h" -extern struct event_base *base; +extern struct ev_loop *base; static void aio_read_cb (gint fd, gint res, gsize len, gpointer data, gpointer ud) diff --git a/test/rspamd_dkim_test.c b/test/rspamd_dkim_test.c index b3a02b631..1cb6bf90e 100644 --- a/test/rspamd_dkim_test.c +++ b/test/rspamd_dkim_test.c @@ -26,7 +26,7 @@ static const gchar test_dkim_sig[] = "v=1; a=rsa-sha256; c=relaxed/relaxed; " "oq3BLHap0GcMTTpSOgfQOKa8Df35Ns11JoOFjdBQ8GpM99kOrJP+vZcT8b7AMfthYm0Kwy" "D9TjlkpScuoY5LjsWVnijh9dSNVLFqLatzg=;"; -extern struct event_base *base; +extern struct ev_loop *base; static void test_key_handler (rspamd_dkim_key_t *key, gsize keylen, rspamd_dkim_context_t *ctx, gpointer ud, GError *err) diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c index 34c35830c..8f0baca84 100644 --- a/test/rspamd_dns_test.c +++ b/test/rspamd_dns_test.c @@ -8,7 +8,7 @@ #include "cfg_file.h" static guint requests = 0; -extern struct event_base *base; +extern struct ev_loop *base; struct rspamd_dns_resolver *resolver; gboolean diff --git a/test/rspamd_http_test.c b/test/rspamd_http_test.c index b81cc0b8b..a813e416c 100644 --- a/test/rspamd_http_test.c +++ b/test/rspamd_http_test.c @@ -73,7 +73,7 @@ rspamd_server_accept (gint fd, short what, void *arg) static void rspamd_http_term_handler (gint fd, short what, void *arg) { - struct event_base *ev_base = arg; + struct ev_loop *ev_base = arg; struct timeval tv = {0, 0}; event_base_loopexit (ev_base, &tv); @@ -84,7 +84,7 @@ rspamd_http_server_func (gint fd, const gchar *path, rspamd_inet_addr_t *addr, struct rspamd_cryptobox_keypair *kp, struct rspamd_keypair_cache *c) { struct rspamd_http_connection_router *rt; - struct event_base *ev_base = event_init (); + struct ev_loop *ev_base = event_init (); struct event accept_ev, term_ev; rt = rspamd_http_router_new (rspamd_server_error, rspamd_server_finish, @@ -148,7 +148,7 @@ rspamd_http_client_func (const gchar *path, rspamd_inet_addr_t *addr, struct rspamd_cryptobox_keypair *kp, struct rspamd_cryptobox_pubkey *peer_kp, struct rspamd_keypair_cache *c, - struct event_base *ev_base, double *latency) + struct ev_loop *ev_base, double *latency) { struct rspamd_http_message *msg; struct rspamd_http_connection *conn; @@ -254,7 +254,7 @@ rspamd_http_stop_servers (pid_t *sfd) void rspamd_http_test_func (void) { - struct event_base *ev_base = event_init (); + struct ev_loop *ev_base = event_init (); rspamd_mempool_t *pool = rspamd_mempool_new (rspamd_mempool_suggest_size (), NULL); struct rspamd_cryptobox_keypair *serv_key, *client_key; struct rspamd_cryptobox_pubkey *peer_key; diff --git a/test/rspamd_test_suite.c b/test/rspamd_test_suite.c index 2abce72a1..728acd8a2 100644 --- a/test/rspamd_test_suite.c +++ b/test/rspamd_test_suite.c @@ -5,7 +5,7 @@ #include "tests.h" struct rspamd_main *rspamd_main = NULL; -struct event_base *base = NULL; +struct ev_loop *base = NULL; worker_t *workers[] = { NULL }; gchar *lua_test = NULL; diff --git a/test/rspamd_upstream_test.c b/test/rspamd_upstream_test.c index 05e0ec730..28015aaf9 100644 --- a/test/rspamd_upstream_test.c +++ b/test/rspamd_upstream_test.c @@ -54,7 +54,7 @@ rspamd_upstream_test_func (void) { struct upstream_list *ls, *nls; struct upstream *up, *upn; - struct event_base *ev_base = event_init (); + struct ev_loop *ev_base = event_init (); struct rspamd_dns_resolver *resolver; struct rspamd_config *cfg; gint i, success = 0; diff --git a/utils/rspamd_http_bench.c b/utils/rspamd_http_bench.c index 32aedb334..14d2db4f9 100644 --- a/utils/rspamd_http_bench.c +++ b/utils/rspamd_http_bench.c @@ -94,7 +94,7 @@ struct client_cbdata { struct lat_elt *lat; guint32 *wconns; gdouble ts; - struct event_base *ev_base; + struct ev_loop *ev_base; }; static void @@ -130,7 +130,7 @@ rspamd_client_finish (struct rspamd_http_connection *conn, } static void -rspamd_http_client_func (struct event_base *ev_base, struct lat_elt *latency, +rspamd_http_client_func (struct ev_loop *ev_base, struct lat_elt *latency, guint32 *wconns, struct rspamd_cryptobox_pubkey *peer_key, struct rspamd_cryptobox_keypair* client_key, @@ -178,7 +178,7 @@ static void rspamd_worker_func (struct lat_elt *plat, guint32 *wconns) { guint i, j; - struct event_base *ev_base; + struct ev_loop *ev_base; struct itimerval itv; struct rspamd_keypair_cache *c = NULL; struct rspamd_cryptobox_keypair *client_key = NULL; @@ -313,7 +313,7 @@ main (int argc, char **argv) GOptionContext *context; GError *error = NULL; pid_t *sfd; - struct event_base *ev_base; + struct ev_loop *ev_base; rspamd_mempool_t *pool = rspamd_mempool_new (8192, "http-bench"); struct event term_ev, int_ev, cld_ev; guint64 total_done; diff --git a/utils/rspamd_http_server.c b/utils/rspamd_http_server.c index 722a52103..8e6b1dadc 100644 --- a/utils/rspamd_http_server.c +++ b/utils/rspamd_http_server.c @@ -58,7 +58,7 @@ static GOptionEntry entries[] = { struct rspamd_http_server_session { struct rspamd_http_connection *conn; - struct event_base *ev_base; + struct ev_loop *ev_base; guint req_size; gboolean reply; gint fd; @@ -132,7 +132,7 @@ rspamd_server_finish (struct rspamd_http_connection *conn, static void rspamd_server_accept (gint fd, short what, void *arg) { - struct event_base *ev_base = arg; + struct ev_loop *ev_base = arg; struct rspamd_http_server_session *session; rspamd_inet_addr_t *addr; gint nfd; @@ -172,7 +172,7 @@ rspamd_server_accept (gint fd, short what, void *arg) static void rspamd_http_term_handler (gint fd, short what, void *arg) { - struct event_base *ev_base = arg; + struct ev_loop *ev_base = arg; struct timeval tv = {0, 0}; event_base_loopexit (ev_base, &tv); @@ -181,7 +181,7 @@ rspamd_http_term_handler (gint fd, short what, void *arg) static void rspamd_http_server_func (gint fd, rspamd_inet_addr_t *addr) { - struct event_base *ev_base = event_init (); + struct ev_loop *ev_base = event_init (); struct event accept_ev, term_ev; event_set (&accept_ev, fd, EV_READ | EV_PERSIST, rspamd_server_accept, ev_base); @@ -245,7 +245,7 @@ main (int argc, gchar **argv) { GOptionContext *context; GError *error = NULL; - struct event_base *ev_base; + struct ev_loop *ev_base; GString *b32_key; pid_t *sfd; rspamd_inet_addr_t *addr; -- 2.39.5