[OpenSER-Devel] dialog module global vars
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Fri May 30 11:22:51 CEST 2008
Hi Dan,
The variable is global as it is used by two functions. Anyhow, the
variable is declared static, so it cannot be accessed (read - messed)
from outside the file.
Regards,
Bogdan
Dan Pascu 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.
>
>
More information about the Devel
mailing list