[SR-Users] route return value confusion

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 13 13:19:16 CET 2011



On 12/13/11 1:03 PM, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>> Thus, no matter what code you return from a subroute, you have to
>> compare against 0 (for negative return code) or 1 (for positive return
>> code).
>>
>> Solutions/alternatives:
> is it not an alternative to fix to change the current implementation so
> that the real return code of route block could be tested?
coding wise might not be a lot, thus I haven't analyzed all the cases 
where functions are evaluated by return code, but it will impact and 
break config file as it used to be so far, for example:

route[x] {
  return -1;
}

if(route(x)) will be true, since if(-1) is true in C
All conditions with functions have to be changed in:

if( f()<0 ) for false cases
if( f(x) > 0) for true cases

At this moment I cannot say for sure if there can be done some 
workaround to get return code and keep old behavior, at first sight 
seems unlikely.

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list