return -1;
}
+ /* Reject a non-default restriction if the Lua VM is already initialised,
+ * which happens when lua-prepend-path appeared before this directive.
+ */
+ if (flags != HLUA_OPENLIBS_ALL && hlua_states[0]) {
+ memprintf(err, "the Lua VM is already initialised; "
+ "the library restriction can't apply correctly. Use \"%s\" before any lua keyword",
+ args[0]);
+ return -1;
+ }
+
hlua_openlibs_flags = flags;
+ hlua_init();
return 0;
}
return -1;
}
+ hlua_init();
+
/* loading for global state */
hlua_state_id = 0;
ha_set_thread(NULL);
return -1;
}
+ hlua_init();
+
if (per_thread_load == NULL) {
/* allocate the first entry large enough to store the final NULL */
per_thread_load = calloc(1, sizeof(*per_thread_load));
struct prepend_path *p = NULL;
size_t i;
+ hlua_init();
+
if (too_many_args(2, args, err, NULL)) {
goto err;
}
INITCALL1(STG_REGISTER, cfg_register_keywords, &cfg_kws);
+
#ifdef USE_OPENSSL
/*
hlua_body = 0;
+ /* Ensure the Lua VM is initialised even if no Lua directive appeared
+ * in the configuration (e.g. no global section at all).
+ */
+ hlua_init();
+
#if defined(USE_OPENSSL)
/* Initialize SSL server. */
if (socket_ssl->xprt->prepare_srv) {
};
#endif
+ if (hlua_states[0])
+ return; /* already initialised */
+
/* Init post init function list head */
for (i = 0; i < MAX_THREADS + 1; i++)
LIST_INIT(&hlua_init_functions[i]);