[OpenSER-Devel] dialog module global vars

Ovidiu Sas osas at voipembedded.com
Thu May 29 21:48:23 CEST 2008


On Thu, May 29, 2008 at 3:40 PM, Dan Pascu <dan at ag-projects.com> wrote:
> On Thursday 29 May 2008, Ovidiu Sas wrote:
>> Hello Dan,
>>
>> Are you refering to:
>> static struct dlg_cb_params params = {NULL, DLG_DIR_NONE, NULL, NULL};
>> ?
>
> Yes, that's the one.
>
>>
>> It was modeled after:
>> static struct tmcb_params params = {0,0,0,0,0,0};
>> from t_hooks.c.
>
> The fact that TM does it, is not an argument in favor of doing it. Using
> global variables with not good reason can lead to subtle and hard to
> track bugs. Not to mention that functions using globals are not reentrant
> and in case we want to change OpenSER to use an asynchronous reactor
> based design (which is a must for properly supporting TCP/TLS), we will
> have big troubles from such globals when doing context switching.

Fell free to change it in this case.  I have no objections.
And maybe the same change should also be applied to the tm module.

Ovidiu



More information about the Devel mailing list