diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-15 16:37:58 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-22 10:57:29 +0100 |
commit | 98897c179754fb04762d325c83f1e057b44697a3 (patch) | |
tree | d53ea0de2cf2fb2e50cefe5496aa80963f8621f5 /src/rspamadm | |
parent | 36ab21685bbf354108a7f12e1dda36761f655e68 (diff) | |
download | rspamd-98897c179754fb04762d325c83f1e057b44697a3.tar.gz rspamd-98897c179754fb04762d325c83f1e057b44697a3.zip |
[Project] First refactoring step libevent->libev
Diffstat (limited to 'src/rspamadm')
-rw-r--r-- | src/rspamadm/control.c | 6 | ||||
-rw-r--r-- | src/rspamadm/lua_repl.c | 6 | ||||
-rw-r--r-- | src/rspamadm/rspamadm.c | 16 |
3 files changed, 14 insertions, 14 deletions
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 <event.h> +#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 |