Browse Source

[core] Enable li_plugins_init_lua again, fixed segfault

personal/stbuehler/wip
Stefan Bühler 12 years ago
parent
commit
5e063e2b04
  1. 2
      src/main/actions.c
  2. 2
      src/main/core_lua.c
  3. 2
      src/main/plugin.c
  4. 9
      src/main/server.c

2
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;

2
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) {

2
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;

9
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;

Loading…
Cancel
Save