From 3b5bb8abc2d116ceb4a8c041075d84851e2711c4 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 3 Nov 2016 16:31:07 +0000 Subject: [PATCH] [Minor] Store ev_base for log_helper callbacks --- src/log_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/log_helper.c b/src/log_helper.c index 74541f62b0..29cb511a3e 100644 --- a/src/log_helper.c +++ b/src/log_helper.c @@ -81,6 +81,7 @@ rspamd_log_helper_read (gint fd, short what, gpointer ud) struct rspamd_protocol_log_message_sum *sm; struct rspamd_worker_lua_script *sc; struct rspamd_config **pcfg; + struct event_base **pevbase; r = read (fd, buf, sizeof (buf)); @@ -131,7 +132,11 @@ rspamd_log_helper_read (gint fd, short what, gpointer ud) lua_rawseti (ctx->L, -2, (i + 1)); } - if (lua_pcall (ctx->L, 6, 0, 0) != 0) { + pevbase = lua_newuserdata (ctx->L, sizeof (*pevbase)); + *pevbase = ctx->ev_base; + rspamd_lua_setclass (ctx->L, "rspamd{ev_base}", -1); + + if (lua_pcall (ctx->L, 7, 0, 0) != 0) { msg_err ("error executing log handler code: %s", lua_tostring (ctx->L, -1)); lua_pop (ctx->L, 1); -- 2.47.3