commit 98897c1: [Project] First refactoring step libevent->libev

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jun 22 12:14:09 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-06-15 16:37:58 +0100
URL: https://github.com/rspamd/rspamd/commit/98897c179754fb04762d325c83f1e057b44697a3

[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 <event.h>
 
 /*
  * 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 <event.h>
+#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 <contrib/librdns/rdns.h>
-#include <contrib/librdns/dns_private.h>
+
 #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 <event.h>
+#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 <event.h>
+#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 <event.h>
+#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 <event.h>
+#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;
*** OUTPUT TRUNCATED, 1843 LINES SKIPPED ***


More information about the Commits mailing list