aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/addr.c2
-rw-r--r--src/libutil/aio_event.c6
-rw-r--r--src/libutil/aio_event.h2
-rw-r--r--src/libutil/http_connection.h2
-rw-r--r--src/libutil/http_context.c8
-rw-r--r--src/libutil/http_context.h8
-rw-r--r--src/libutil/http_private.h2
-rw-r--r--src/libutil/http_router.h2
-rw-r--r--src/libutil/map.c2
-rw-r--r--src/libutil/map.h4
-rw-r--r--src/libutil/map_private.h4
-rw-r--r--src/libutil/ssl_util.c4
-rw-r--r--src/libutil/ssl_util.h2
-rw-r--r--src/libutil/upstream.c4
-rw-r--r--src/libutil/upstream.h2
-rw-r--r--src/libutil/util.c2
-rw-r--r--src/libutil/util.h11
17 files changed, 29 insertions, 38 deletions
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 <event.h>
+#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 <event.h>
+#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 <event.h>
+#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 <event.h>
+#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 <netdb.h>
#endif
-#include <event.h>
+#include "contrib/libev/ev.h"
#include <time.h>
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);