Lines Matching refs:L

21 static int _dump_helper(lua_State *L, const void *p, size_t sz, void *ud) {  in _dump_helper()  argument
22 (void)L; in _dump_helper()
38 static const char * _load_helper(lua_State *L, void *data, size_t *size) { in _load_helper() argument
39 (void)L; in _load_helper()
105 lua_State *L = ctx->proxy_state; in _proxy_manager_thread() local
118 luaL_unref(L, LUA_REGISTRYINDEX, g->self_ref); in _proxy_manager_thread()
124 lua_gc(L, LUA_GCCOLLECT); in _proxy_manager_thread()
127 lua_gc(L, LUA_GCCOLLECT); in _proxy_manager_thread()
212 lua_State *L = ctx->proxy_state; in proxy_config_reload() local
213 lua_settop(L, 0); // clear off any crud that could have been left on the stack. in proxy_config_reload()
274 lua_State *L = ctx->proxy_state; in proxy_run_crons() local
275 assert(lua_gettop(L) == 0); in proxy_run_crons()
280 lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->cron_ref); in proxy_run_crons()
291 lua_pushnil(L); in proxy_run_crons()
292 while (lua_next(L, 1) != 0) { in proxy_run_crons()
293 const char *key = lua_tostring(L, -2); in proxy_run_crons()
294 mcp_cron_t *ce = lua_touserdata(L, -1); in proxy_run_crons()
295 int idx = lua_absindex(L, -1); in proxy_run_crons()
300 lua_pushnil(L); in proxy_run_crons()
301 lua_setfield(L, 1, key); in proxy_run_crons()
304 lua_getiuservalue(L, idx, 1); in proxy_run_crons()
306 int res = lua_pcall(L, 0, 0, 0); in proxy_run_crons()
309 LOGGER_LOG(NULL, LOG_PROXYEVENTS, LOGGER_PROXY_ERROR, NULL, lua_tostring(L, -1)); in proxy_run_crons()
311 lua_pop(L, 1); // drop error. in proxy_run_crons()
322 lua_pushnil(L); in proxy_run_crons()
323 lua_setfield(L, 1, key); in proxy_run_crons()
332 lua_pop(L, 1); // drop value so we can loop. in proxy_run_crons()
335 lua_pop(L, 1); // drop cron table. in proxy_run_crons()
448 lua_State *L = ctx->proxy_state; in proxy_load_files() local
458 res = luaL_loadfile(L, db->fname); in proxy_load_files()
460 fprintf(stderr, "ERROR: Failed to load proxy_startfile: %s\n", lua_tostring(L, -1)); in proxy_load_files()
467 lua_dump(L, _dump_helper, db, 0); in proxy_load_files()
471 res = lua_pcall(L, 0, LUA_MULTRET, 0); in proxy_load_files()
473 … fprintf(stderr, "ERROR: Failed to load data into lua config state: %s\n", lua_tostring(L, -1)); in proxy_load_files()
485 lua_State *L = ctx->proxy_state; in proxy_load_config() local
499 lua_getglobal(L, "mcp_config_pools"); in proxy_load_config()
501 if (lua_isnil(L, -1)) { in proxy_load_config()
505 lua_pushnil(L); // no "old" config yet. in proxy_load_config()
506 if (lua_pcall(L, 1, 1, 0) != LUA_OK) { in proxy_load_config()
507 fprintf(stderr, "ERROR: Failed to execute mcp_config_pools: %s\n", lua_tostring(L, -1)); in proxy_load_config()
641 lua_State *L = thr->L; in proxy_thread_loadconf() local
647 int res = lua_load(L, _load_helper, db, "config", NULL); in proxy_thread_loadconf()
649 fprintf(stderr, "Failed to load data into worker thread: %s\n", lua_tostring(L, -1)); in proxy_thread_loadconf()
653 res = lua_pcall(L, 0, LUA_MULTRET, 0); in proxy_thread_loadconf()
656 fprintf(stderr, "Failed to load data into worker thread: %s\n", lua_tostring(L, -1)); in proxy_thread_loadconf()
663 lua_getglobal(L, "mcp_config_routes"); in proxy_thread_loadconf()
680 _copy_config_table(ctx->proxy_state, L, thr); in proxy_thread_loadconf()
683 if (lua_pcall(L, 1, 0, 0) != LUA_OK) { in proxy_thread_loadconf()
684 fprintf(stderr, "Failed to execute mcp_config_routes: %s\n", lua_tostring(L, -1)); in proxy_thread_loadconf()