You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2013/04/19 11:02:33 UTC
Re: svn commit: r1469744 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml
modules/lua/lua_request.c modules/lua/lua_request.h
humbedooh@apache.org wrote:
> Author: humbedooh
> Date: Fri Apr 19 08:46:28 2013
> New Revision: 1469744
>
> URL: http://svn.apache.org/r1469744
> Log:
> Remove lua_ap_banner, as it's no longer being used.
> Add ivm_get/ivm_set for Inter-VM data transfer. This allows multiple VMs across a process to share data without having to resort to external databases or filesystems. This is a work in progress, and I have yet to work out a proper way of resetting a variable without causing a memory leak (this could be done by allocating a new pool for each object, but I'm trying to see if there's a more efficient way). Comments, ideas etc are most welcome.
>
> Modified:
> httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
> httpd/httpd/trunk/modules/lua/lua_request.c
> httpd/httpd/trunk/modules/lua/lua_request.h
>
> Modified: httpd/httpd/trunk/modules/lua/lua_request.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=1469744&r1=1469743&r2=1469744&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/lua/lua_request.c (original)
> +++ httpd/httpd/trunk/modules/lua/lua_request.c Fri Apr 19 08:46:28 2013
> @@ -1665,6 +1661,49 @@ static int req_debug(lua_State *L)
> return req_log_at(L, APLOG_DEBUG);
> }
>
> +static int lua_ivm_get(lua_State *L) {
> + const char *key, *raw_key;
> + lua_ivm_object *object = NULL;
> + request_rec *r = ap_lua_check_request_rec(L, 1);
> + key = luaL_checkstring(L, 2);
> + raw_key = apr_pstrcat(r->pool, "lua_ivm_", key, NULL);
> + apr_pool_userdata_get((void **)&object, raw_key, r->server->process->pool);
> + if (object) {
> + if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);
> + else if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);
Isn't that the same condition twice above?
> + else if (object->type == LUA_TNUMBER) lua_pushnumber(L, object->number);
> + else if (object->type == LUA_TSTRING) lua_pushlstring(L, object->string, object->size);
> + return 1;
> + }
> + else {
> + return 0;
> + }
> +}
> +
> +
Regards
RĂ¼diger
Re: svn commit: r1469744 - in /httpd/httpd/trunk: docs/manual/mod/mod_lua.xml
modules/lua/lua_request.c modules/lua/lua_request.h
Posted by Daniel Gruno <ru...@cord.dk>.
On 04/19/2013 11:02 AM, Ruediger Pluem wrote:
>
>
> humbedooh@apache.org wrote:
>> Author: humbedooh
>> Date: Fri Apr 19 08:46:28 2013
>> New Revision: 1469744
>>
>> URL: http://svn.apache.org/r1469744
>> Log:
>> Remove lua_ap_banner, as it's no longer being used.
>> Add ivm_get/ivm_set for Inter-VM data transfer. This allows multiple VMs across a process to share data without having to resort to external databases or filesystems. This is a work in progress, and I have yet to work out a proper way of resetting a variable without causing a memory leak (this could be done by allocating a new pool for each object, but I'm trying to see if there's a more efficient way). Comments, ideas etc are most welcome.
>>
>> Modified:
>> httpd/httpd/trunk/docs/manual/mod/mod_lua.xml
>> httpd/httpd/trunk/modules/lua/lua_request.c
>> httpd/httpd/trunk/modules/lua/lua_request.h
>>
>
>> Modified: httpd/httpd/trunk/modules/lua/lua_request.c
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_request.c?rev=1469744&r1=1469743&r2=1469744&view=diff
>> ==============================================================================
>> --- httpd/httpd/trunk/modules/lua/lua_request.c (original)
>> +++ httpd/httpd/trunk/modules/lua/lua_request.c Fri Apr 19 08:46:28 2013
>
>> @@ -1665,6 +1661,49 @@ static int req_debug(lua_State *L)
>> return req_log_at(L, APLOG_DEBUG);
>> }
>>
>> +static int lua_ivm_get(lua_State *L) {
>> + const char *key, *raw_key;
>> + lua_ivm_object *object = NULL;
>> + request_rec *r = ap_lua_check_request_rec(L, 1);
>> + key = luaL_checkstring(L, 2);
>> + raw_key = apr_pstrcat(r->pool, "lua_ivm_", key, NULL);
>> + apr_pool_userdata_get((void **)&object, raw_key, r->server->process->pool);
>> + if (object) {
>> + if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);
>> + else if (object->type == LUA_TBOOLEAN) lua_pushboolean(L, object->number);
>
> Isn't that the same condition twice above?
>
>> + else if (object->type == LUA_TNUMBER) lua_pushnumber(L, object->number);
>> + else if (object->type == LUA_TSTRING) lua_pushlstring(L, object->string, object->size);
>> + return 1;
>> + }
>> + else {
>> + return 0;
>> + }
>> +}
>> +
>> +
>
> Regards
>
> RĂ¼diger
>
you're absolutely right, silly of me :)
I'll fix right away.
With regards,
Daniel.