return AP_LUA_SCOPE_CONN;
if (0 == strcmp("conn", name))
return AP_LUA_SCOPE_CONN;
- if (0 == strcmp("server", name))
- return AP_LUA_SCOPE_SERVER;
+ if (0 == strcmp("thread", name))
+ return AP_LUA_SCOPE_THREAD;
return AP_LUA_SCOPE_ONCE;
}
*/
#include "mod_lua.h"
#include "http_log.h"
-#include "apr_reslist.h"
#include "apr_uuid.h"
#include "lua_config.h"
#include "apr_file_info.h"
return APR_SUCCESS;
}
-static apr_status_t vm_release(void *vm)
-{
- apr_reslist_t* reslist;
- lua_pushlightuserdata(vm,vm);
- lua_rawget(vm,LUA_REGISTRYINDEX);
- reslist = (apr_reslist_t*)lua_topointer(vm,-1);
-
- return apr_reslist_release(reslist, vm);
-}
-
-static apr_status_t vm_reslist_destroy(void *data)
-{
- return apr_reslist_destroy(data);
-}
-
/**
* Function used to create a lua_State instance bound into the web
* server in the appropriate scope.
#define AP_LUA_SCOPE_ONCE 1
#define AP_LUA_SCOPE_REQUEST 2
#define AP_LUA_SCOPE_CONN 3
-#define AP_LUA_SCOPE_SERVER 4
+#define AP_LUA_SCOPE_THREAD 4
typedef void (*ap_lua_state_open_callback) (lua_State *L, apr_pool_t *p,
/* name of base file to load in the vm */
char *file;
- /* APL_SCOPE_ONCE | APL_SCOPE_REQUEST | APL_SCOPE_CONN | APL_SCOPE_SERVER */
+ /* APL_SCOPE_ONCE | APL_SCOPE_REQUEST | APL_SCOPE_CONN | APL_SCOPE_THREAD */
int scope;
ap_lua_state_open_callback cb;
spec = apr_pcalloc(r->pool, sizeof(ap_lua_vm_spec));
spec->scope = dcfg->vm_scope;
- spec->pool = spec->scope==AP_LUA_SCOPE_SERVER ? cfg->pool : r->pool;
+ spec->pool = r->pool;
spec->file = r->filename;
spec->package_paths = cfg->package_paths;
spec->package_cpaths = cfg->package_cpaths;
spec->scope = hook_spec->scope;
spec->bytecode = hook_spec->bytecode;
spec->bytecode_len = hook_spec->bytecode_len;
- spec->pool = spec->scope==AP_LUA_SCOPE_SERVER ? cfg->pool : r->pool;
+ spec->pool = r->pool;
spec->package_paths = cfg->package_paths;
spec->package_cpaths = cfg->package_cpaths;
spec->cb = &lua_open_callback;
else if (strcmp("conn", scope) == 0) {
cfg->vm_scope = AP_LUA_SCOPE_CONN;
}
- else if (strcmp("server", scope) == 0) {
- cfg->vm_scope = AP_LUA_SCOPE_SERVER;
+ else if (strcmp("thread", scope) == 0) {
+ cfg->vm_scope = AP_LUA_SCOPE_THREAD;
}
else {
return apr_psprintf(cmd->pool,