]> granicus.if.org Git - apache/commitdiff
remove lingering reslist references before killing server scope
authorBrian McCallister <brianm@apache.org>
Thu, 10 Nov 2011 23:57:57 +0000 (23:57 +0000)
committerBrian McCallister <brianm@apache.org>
Thu, 10 Nov 2011 23:57:57 +0000 (23:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200646 13f79535-47bb-0310-9956-ffa450edef68

modules/lua/lua_config.c
modules/lua/lua_vmprep.c
modules/lua/lua_vmprep.h
modules/lua/mod_lua.c

index 40ad8fd7c799300628552bb5ff46c55c988cb867..84356d71fd2da99a750f6150f73e9d05a1999397 100644 (file)
@@ -46,8 +46,8 @@ static int apl_toscope(const char *name)
         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;
 }
 
index 8e38decebd50526f8889796320fc947fe61212b4..6af677a62c137ea270503cfebc1caad1f49e6cfc 100644 (file)
@@ -16,7 +16,6 @@
  */
 #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"
@@ -403,21 +402,6 @@ static apr_status_t vm_destruct(void *vm, void *params, apr_pool_t *pool)
     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.
index b3cbd2b778a71876a86ec99c3facc07923713663..ed9c65ef28c8dcfbde2cd16592925c960f7a4630 100644 (file)
@@ -37,7 +37,7 @@
 #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,
@@ -55,7 +55,7 @@ typedef struct
     /* 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;
index 04cd363de7a68b9329d6e9baab20a5d8e5c39c70..6458476c34f7ab3f55c102530820cf02b69a5521 100644 (file)
@@ -100,7 +100,7 @@ static int lua_handler(request_rec *r)
 
         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;
@@ -172,7 +172,7 @@ static int lua_request_rec_hook_harness(request_rec *r, const char *name, int ap
             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;
@@ -836,8 +836,8 @@ static const char *register_lua_scope(cmd_parms *cmd,
     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,