On Oct 02, 2010 at 18:30, Iñaki Baz Castillo
<ibc(a)aliax.net> wrote:
2010/10/2 Daniel-Constantin Mierla
<miconda(a)gmail.com>om>:
> So my question is: should I check the rank
parameter in child_init
> function just to run the code for real workers?
yes, check it. The phrases use same term, while in one case should be 'sip
worker process' to differentiate from other type of workers.
Beware than from v3.0 you get also rank PROC_INIT, which is called for main
process after all mod_init functions were executed.
Then, is it ok if I use:
if (rank==PROC_INIT || rank==PROC_MAIN || rank==PROC_TCP_MAIN)
return 0;
?
Yes.
Depending on what your code does you could also add PROC_RPC and
PROC_UNIXSOCK if you don't need to do anything in the RPC processes.
Do not do this if you implement some RPC function that uses some
local per process stuff you initialized in child_init() (for example
a db connection, an open file).
what about possible PROC_SCTP_MAIN (if it exists) and others?
There is no PROC_SCTP_MAIN.
I've checked that all those special processes
(non workers) as rack <=
0. Is it safe if I just apply the code for processes with rank > 0?
Yes, but you might need the initialization to run for the RPC processes
(see above). If you use any timer you might also need the
initialization in the timer processes. In this case you could use:
if (rank > 0 || rank == PROC_TIMER || rank == PROC_RPC ||
rank == PROC_UNIXSOCK)
A rank > 0 means a normal sip-router worker process and values <=0 are
special.
Andrei
P.S.: PROC_UNIXSOCK is deprecated.
Thanks Andrei. Where could I get the complete list DEFINE's for
special processes? For example I expect there is also something as
PROC_MI, is it?