diff --git a/src/main/actions.c b/src/main/actions.c index 130cd44..5711831 100644 --- a/src/main/actions.c +++ b/src/main/actions.c @@ -331,7 +331,9 @@ liHandlerResult li_action_execute(liVRequest *vr) { break; case LI_HANDLER_ERROR: li_action_stack_reset(vr, as); + return res; case LI_HANDLER_COMEBACK: + return res; case LI_HANDLER_WAIT_FOR_EVENT: if (ase != action_stack_top(as)) break; /* allow an action to push another action and rerun after it again */ return res; diff --git a/src/main/core_lua.c b/src/main/core_lua.c index cb54765..0968c75 100644 --- a/src/main/core_lua.c +++ b/src/main/core_lua.c @@ -298,7 +298,7 @@ void li_lua_init(lua_State *L, liServer *srv, liWorker *wrk) { li_lua_store_globals(L); - //li_plugins_init_lua(L, srv, wrk); + li_plugins_init_lua(L, srv, wrk); } void li_lua_restore_globals(lua_State *L) { diff --git a/src/main/plugin.c b/src/main/plugin.c index 71462dc..7d5c8fd 100644 --- a/src/main/plugin.c +++ b/src/main/plugin.c @@ -691,6 +691,8 @@ void li_plugins_init_lua(struct lua_State *L, liServer *srv, liWorker *wrk) { liPlugin *p; gpointer v; + if (NULL == srv->plugins) return; + g_hash_table_iter_init(&iter, srv->plugins); while (g_hash_table_iter_next(&iter, NULL, &v)) { p = (liPlugin*) v; diff --git a/src/main/server.c b/src/main/server.c index eb07336..977e779 100644 --- a/src/main/server.c +++ b/src/main/server.c @@ -350,6 +350,11 @@ static gboolean li_server_worker_init(liServer *srv) { ev_timer_start(loop, &srv->srv_1sec_timer); ev_unref(loop); /* don't keep loop alive */ +#ifdef HAVE_LUA_H + li_plugins_init_lua(srv->L, srv, NULL); + li_plugins_init_lua(srv->main_worker->L, srv, srv->main_worker); +#endif + if (srv->worker_count < 1) srv->worker_count = 1; g_array_set_size(srv->workers, srv->worker_count); g_array_index(srv->workers, liWorker*, 0) = srv->main_worker; @@ -361,6 +366,10 @@ static gboolean li_server_worker_init(liServer *srv) { } wrk = g_array_index(srv->workers, liWorker*, i) = li_worker_new(srv, loop); wrk->ndx = i; + +#ifdef HAVE_LUA_H + li_plugins_init_lua(wrk->L, srv, wrk); +#endif } return TRUE;