diff options
author | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-06 09:19:57 +0100 |
---|---|---|
committer | Mikhail Galanin <mgalanin@mimecast.com> | 2018-09-06 09:19:57 +0100 |
commit | 4c4c9f45c48992c5969923fa3bd7383f794fdc8a (patch) | |
tree | fe70699bf21760a53d226a05f20c37a5c8d665e2 /src/rspamadm/lua_repl.c | |
parent | 49fb6ed4d68e7691b5219c78fd0837ca4e2f7b94 (diff) | |
download | rspamd-4c4c9f45c48992c5969923fa3bd7383f794fdc8a.tar.gz rspamd-4c4c9f45c48992c5969923fa3bd7383f794fdc8a.zip |
[Minor] Reworked other parts of rspamadm to handle asynchronous events
Diffstat (limited to 'src/rspamadm/lua_repl.c')
-rw-r--r-- | src/rspamadm/lua_repl.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c index 39fa07480..710b9c5ef 100644 --- a/src/rspamadm/lua_repl.c +++ b/src/rspamadm/lua_repl.c @@ -72,23 +72,13 @@ struct rspamadm_lua_dot_command { rspamadm_lua_dot_handler handler; }; -struct lua_call_data { - gint top; - gint ret; - gpointer ud; -}; - static void rspamadm_lua_help_handler (lua_State *L, gint argc, gchar **argv); static void rspamadm_lua_load_handler (lua_State *L, gint argc, gchar **argv); static void rspamadm_lua_exec_handler (lua_State *L, gint argc, gchar **argv); static void rspamadm_lua_message_handler (lua_State *L, gint argc, gchar **argv); -static void lua_execute_and_wait (gint narg); static void lua_thread_error_cb (struct thread_entry *thread, int ret, const char *msg); static void lua_thread_finish_cb (struct thread_entry *thread, int ret); -static gint lua_repl_thread_call (struct thread_entry *thread, gint narg, - gpointer ud, lua_thread_error_t error_func); - static struct rspamadm_lua_dot_command cmds[] = { { @@ -306,12 +296,12 @@ wait_session_events () } } -static gint +gint lua_repl_thread_call (struct thread_entry *thread, gint narg, gpointer ud, lua_thread_error_t error_func) { int ret; struct lua_call_data *cd = g_new0 (struct lua_call_data, 1); - cd->top = lua_gettop (L); + cd->top = lua_gettop (thread->lua_state); cd->ud = ud; thread->finish_callback = lua_thread_finish_cb; @@ -736,6 +726,7 @@ rspamadm_lua (gint argc, gchar **argv, const struct rspamadm_command *cmd) GError *error = NULL; gchar **elt; guint i; + lua_State *L = rspamd_main->cfg->lua_state; context = g_option_context_new ("lua - run lua interpreter"); g_option_context_set_summary (context, |