[Serdev] ser-0.8.12 minor code inconsistency

Jiri Kuthan jiri at iptel.org
Mon Aug 9 00:21:45 UTC 2004


Thanks for reporting. That indeed looks like an inconsistency.

I think the confusing error code passing is suppposed  not to 
disturb TCP processing ('goto end' returns 0 -> TCP processing 
continues) if SIP pre-script callback failed. 

The action item to me is too review when should be
TCP processing discontinued in receive_msg by returning
value <0 (i.e., calling 'goto error'). Possibly, some  "goto error" 
cases may be replaced with "goto end". Obviously, the  one you 
mentioned is never called and can be replaced with ";".

Authoritative answer to come from maintainer of the code
in question, Andrei, who is currently on vacation.

-jiri

At 10:01 AM 7/28/2004, Maxim Yegorushkin wrote:
>Hello guys,
>
>I've found some inconsistency between receive_msg() and exec_pre_cb()
>functions.
>
>Here are the related snippets:
>
>receive_msg()
>    /* ... */
>    ret=exec_pre_cb(msg);
>    if (ret<=0){
>        if (ret<0) goto error;
>        else goto end; /* drop the message -- no error -- andrei */
>
>int exec_pre_cb( struct sip_msg *msg)
>{
>    struct script_cb *i;
>    for (i=pre_cb; i; i=i->next) {
>        /* stop on error */
>        if (i->cbf(msg, i->param)==0)
>        return 0;
>    }
>    return 1;
>}
>
>It looks like receive_msg() expects to get the following codes: ret < 0
>- error, ret == 0 - drop, ret > 0 - ok. While exec_pre_cb() never
>reports and error always responding with drop or ok.
>
>I thought you might want to fix it.
>
>-- 
>Maxim Yegorushkin
>Software Engineering  
>my at ipcb.net
>+7 095 744-1140 phone
>+7 095 744-1130 fax
>www.ipcb.net
>
>
>_______________________________________________
>Serdev mailing list
>serdev at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serdev

--
Jiri Kuthan            http://iptel.org/~jiri/  




More information about the Serdev mailing list