diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-19 18:23:46 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-06-22 10:57:29 +0100 |
commit | dc96f9b37ff98c12b7aeacd348162950c129098f (patch) | |
tree | 22b6f950bd71a90b020cdd708de5d1bd7f3e1dde /src/rspamadm/lua_repl.c | |
parent | 63f823eb9d6b4cfed6c3014ab350dfc61f33cb28 (diff) | |
download | rspamd-dc96f9b37ff98c12b7aeacd348162950c129098f.tar.gz rspamd-dc96f9b37ff98c12b7aeacd348162950c129098f.zip |
[Project] Make it compileable again...
Diffstat (limited to 'src/rspamadm/lua_repl.c')
-rw-r--r-- | src/rspamadm/lua_repl.c | 23 |
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); } |