summaryrefslogtreecommitdiffstats
path: root/src/rspamadm
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-19 18:23:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-06-22 10:57:29 +0100
commitdc96f9b37ff98c12b7aeacd348162950c129098f (patch)
tree22b6f950bd71a90b020cdd708de5d1bd7f3e1dde /src/rspamadm
parent63f823eb9d6b4cfed6c3014ab350dfc61f33cb28 (diff)
downloadrspamd-dc96f9b37ff98c12b7aeacd348162950c129098f.tar.gz
rspamd-dc96f9b37ff98c12b7aeacd348162950c129098f.zip
[Project] Make it compileable again...
Diffstat (limited to 'src/rspamadm')
-rw-r--r--src/rspamadm/control.c5
-rw-r--r--src/rspamadm/lua_repl.c23
-rw-r--r--src/rspamadm/rspamadm.c15
3 files changed, 14 insertions, 29 deletions
diff --git a/src/rspamadm/control.c b/src/rspamadm/control.c
index 754d874a2..0aa995abf 100644
--- a/src/rspamadm/control.c
+++ b/src/rspamadm/control.c
@@ -111,7 +111,6 @@ rspamd_control_finish_handler (struct rspamd_http_connection *conn,
const gchar *body;
gsize body_len;
struct rspamadm_control_cbdata *cbdata = conn->ud;
- struct timeval exit_tv;
body = rspamd_http_message_get_body (msg, &body_len);
parser = ucl_parser_new (0);
@@ -157,9 +156,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->event_loop, &exit_tv);
+ ev_break (rspamd_main->event_loop, EVBREAK_ALL);
return 0;
}
diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c
index a95521bdb..46fc342ea 100644
--- a/src/rspamadm/lua_repl.c
+++ b/src/rspamadm/lua_repl.c
@@ -515,7 +515,7 @@ rspamadm_lua_run_repl (lua_State *L)
{
gchar *input;
gboolean is_multiline = FALSE;
- GString *tb;
+ GString *tb = NULL;
guint i;
for (;;) {
@@ -591,15 +591,16 @@ struct rspamadm_lua_repl_session {
};
static void
-rspamadm_lua_accept_cb (gint fd, short what, void *arg)
+rspamadm_lua_accept_cb (EV_P_ ev_io *w, int revents)
{
- struct rspamadm_lua_repl_context *ctx = arg;
+ struct rspamadm_lua_repl_context *ctx =
+ (struct rspamadm_lua_repl_context *)w->data;
rspamd_inet_addr_t *addr;
struct rspamadm_lua_repl_session *session;
gint nfd;
if ((nfd =
- rspamd_accept_from_socket (fd, &addr, NULL)) == -1) {
+ rspamd_accept_from_socket (w->fd, &addr, NULL, NULL)) == -1) {
rspamd_fprintf (stderr, "accept failed: %s", strerror (errno));
return;
}
@@ -808,7 +809,7 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd)
ctx = g_malloc0 (sizeof (*ctx));
http = rspamd_http_router_new (rspamadm_lua_error_handler,
rspamadm_lua_finish_handler,
- NULL,
+ 0.0,
NULL,
rspamd_main->http_ctx);
ctx->L = L;
@@ -822,19 +823,17 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd)
fd = rspamd_inet_address_listen (addr, SOCK_STREAM, TRUE);
if (fd != -1) {
- struct event *ev;
+ static ev_io ev;
- ev = g_malloc0 (sizeof (*ev));
- event_set (ev, fd, EV_READ|EV_PERSIST, rspamadm_lua_accept_cb,
- ctx);
- event_base_set (ev_base, ev);
- event_add (ev, NULL);
+ ev.data = ctx;
+ ev_io_init (&ev, rspamadm_lua_accept_cb, fd, EV_READ);
+ ev_io_start (ev_base, &ev);
rspamd_printf ("listen on %s\n",
rspamd_inet_address_to_string_pretty (addr));
}
}
- event_base_loop (ev_base, 0);
+ ev_loop (ev_base, 0);
exit (EXIT_SUCCESS);
}
diff --git a/src/rspamadm/rspamadm.c b/src/rspamadm/rspamadm.c
index 4320c2460..5908f77f9 100644
--- a/src/rspamadm/rspamadm.c
+++ b/src/rspamadm/rspamadm.c
@@ -379,15 +379,6 @@ main (gint argc, gchar **argv, gchar **env)
rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),
"rspamadm");
-#ifdef HAVE_EVENT_NO_CACHE_TIME_FLAG
- struct event_config *ev_cfg;
- ev_cfg = event_config_new ();
- 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->event_loop = event_init ();
-#endif
-
rspamadm_fill_internal_commands (all_commands);
help_command.command_data = all_commands;
@@ -565,10 +556,8 @@ main (gint argc, gchar **argv, gchar **env)
cmd->run (0, NULL, cmd);
}
- event_base_loopexit (rspamd_main->event_loop, NULL);
-#ifdef HAVE_EVENT_NO_CACHE_TIME_FLAG
- event_config_free (ev_cfg);
-#endif
+ ev_break (rspamd_main->event_loop, EVBREAK_ALL);
+
REF_RELEASE (rspamd_main->cfg);
rspamd_log_close (rspamd_main->logger, TRUE);