Commit ad1b3c4e authored by Brian McCallister's avatar Brian McCallister
Browse files

remove lingering reslist references before killing server scope

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200646 13f79535-47bb-0310-9956-ffa450edef68
parent 8e0a1bbf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}

+0 −16
Original line number Diff line number Diff line
@@ -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.
+2 −2
Original line number Diff line number Diff line
@@ -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;
+4 −4
Original line number Diff line number Diff line
@@ -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,