[OpenSER-Devel] dialog module global vars

Dan Pascu dan at ag-projects.com
Thu May 29 21:40:58 CEST 2008


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.

-- 
Dan



More information about the Devel mailing list