[sr-dev] Resetting private variables between requests?
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jan 23 08:53:45 CET 2017
Hello,
adding a new class of variables with such behaviour is ok.
The $var(...) has already a variant $vn(...):
-
https://www.kamailio.org/wiki/cookbooks/devel/pseudovariables#vn_name_-_private_memory_variables_null
$var() is initialized to 0, $vn() is to $null. iirc, there are flags to
make the difference, I think that can be reused to add another type of
private vars.
Cheers,
Daniel
On 21/01/2017 09:20, Armen Babikyan wrote:
> Hi Daniel,
>
> Thanks for your response.
>
> Any thoughts to my later comments? i.e. would you consider a patch
> that resets these variables between top-level request_route
> executions, either by $var(all) = $null, and/or modparam behavior,
> and/or something else?
>
> BTW, is the current behavior done this way for a specific reason or
> foreseen complication (i.e. one that I am not seeing at the moment)?
>
> Thanks!
>
> Armen
>
> On Wed, Jan 18, 2017 at 6:35 AM, Daniel-Constantin Mierla
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
> Hello,
>
> preparing the release of v4.4.5 and digesting the sr-dev mailing
> list activity, I noticed that this was not answered.
>
> The $var(x) type of variables is not reset, they persist over
> execution of the routing blocks. Their values are stored in
> private memory, so they are like global variables per each
> kamailio process/worker. You have to reset them explicitly.
>
> Cheers,
> Daniel
>
>
> On 26/11/2016 00:19, Armen Babikyan wrote:
>> Hello,
>>
>> I recall reading somewhere that all private variables (i.e.
>> $var(foo)-style pvs) are reset/destroyed between request_route
>> executions, but I have a suspicion this is not happening - either
>> in some limited cases or perhaps in all cases.
>>
>> I suppose the most telling symptom is that I see no references to
>> either destroy_vars() or reset_vars() functions that are defined
>> in $kamailio/modules/pv/pv_svar.{c,h}.
>>
>> Is this behavior intentional? If so, I'll see what I can do
>> about implementing a mechanism that manually resets (or
>> destroys?) variables with a "$var(all) = $null;"-type of
>> statement (similar to "$uac_req(all) = $null;"), or making a
>> modparam setting that automatically does this.
>>
>> Thoughts welcome. Thanks!
>>
>> Armen
>>
>>
>>
>> _______________________________________________
>> sr-dev mailing list
>> sr-dev at lists.sip-router.org <mailto:sr-dev at lists.sip-router.org>
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>> <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev>
>
> --
> Daniel-Constantin Mierla
> www.twitter.com/miconda <http://www.twitter.com/miconda> -- www.linkedin.com/in/miconda <http://www.linkedin.com/in/miconda>
> Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com <http://www.kamailioworld.com>
>
--
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Mar 6-8 (Europe) and Mar 20-22 (USA) - www.asipto.com
Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20170123/fb546d71/attachment-0001.html>
More information about the sr-dev
mailing list