[Users] Re: [Devel] test return code in config file
Daniel-Constantin Mierla
daniel at voice-system.ro
Wed Jun 29 17:51:34 CEST 2005
On 06/29/05 18:36, Klaus Darilion wrote:
> Bogdan-Andrei Iancu wrote:
>
>>
>>>
>>> Is there a differnce between
>>> return(0);
>>> and
>>> break;
>>> ?
>>>
>> just to clarify a little bit - the return code convention is like
>> this: if a function returns 0, the entire script execution will be
>> stopped. If is a negative value -> false; if positive ->true.
>> Now, return(0) returns with code 0 -> is the same as exit -> it will
>> terminated the script execution.
>> on the other hand, break is used to terminate only the current route
>> (is similar to return(1) )
>
>
> Are you sure?
yes.
> AFAIK break; return 0
that happens in ser, but has changed in openser to keep the
compatibility -- in ser, break exists from current route and if(route())
is always true if there was a break.
This is a bug is ser because many functions exported for use in config
rely that when returning 0, no further processing takes place (e.g.,
t_newtran() returns 0 if detects retransmission and if the t_newtran()
is used in other route than 0, the retransmissions are processed).
So, in openser, 'break' is return(1) and there is also 'exit' which is
return(0).
> If return(0) also returns 0, then it is like break and only exits from
> the current route block.
>
> If your statement is correct, it is possible to exit ser.cfg from any
> route block by return(0)?
yes, you can exit cfg from any route -- you can use also 'exit' which is
more appropriate as name.
> I didn't knew that.
It is written in the file with changes from ser to openser, but maybe
not that obviously.
Regards,
Daniel
>
> regards,
> klaus
>
More information about the sr-users
mailing list