aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamadm/lua_repl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rspamadm/lua_repl.c')
-rw-r--r--src/rspamadm/lua_repl.c23
1 files changed, 11 insertions, 12 deletions
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);
}