On Jan 15, 2009 at 17:14, Miklos Tirpak <[email protected]> wrote:
> Hi Andrei,
> 
> the attached patch introduces a small function that can be used to 
> distinguish between a branch timeout and the complete transaction 
> lifetime timeout. May I apply it?

Yes, sure.

Only one non important observation:
(s_ticks_t)(t->end_of_life-get_ticks_raw())>0

can be replaced with
TICKS_GT(t->end_of_life, get_ticks_raw())
(#include "../../timer_ticks.h").

Andrei

> 
> Thanks,
> Miklos

> ? doc/diff.txt
> Index: tm.c
> ===================================================================
> RCS file: /cvsroot/ser/sip_router/modules/tm/tm.c,v
> retrieving revision 1.177
> diff -u -a -r1.177 tm.c
> --- tm.c      10 Nov 2008 12:47:02 -0000      1.177
> +++ tm.c      15 Jan 2009 16:09:57 -0000
> @@ -229,6 +229,7 @@
>  static int t_any_timeout(struct sip_msg* msg, char*, char*);
>  static int t_any_replied(struct sip_msg* msg, char*, char*);
>  static int t_is_canceled(struct sip_msg* msg, char*, char*);
> +static int t_is_expired(struct sip_msg* msg, char*, char*);
>  static int t_grep_status(struct sip_msg* msg, char*, char*);
>  static int w_t_drop_replies(struct sip_msg* msg, char* foo, char* bar);
>  static int w_t_save_lumps(struct sip_msg* msg, char* foo, char* bar);
> @@ -360,6 +361,8 @@
>                       REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE 
> },
>       {"t_is_canceled",     t_is_canceled,            0, 0,
>                       REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE 
> },
> +     {"t_is_expired",      t_is_expired,             0, 0,
> +                     REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE 
> },
>       {"t_grep_status",     t_grep_status,            1, fixup_var_int_1, 
>                       REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE 
> },
>       {"t_drop_replies",    w_t_drop_replies,         0, 0,
> @@ -1551,6 +1554,25 @@
>               ret=-1;
>       }else{
>               ret=(t->flags & T_CANCELED)?1:-1;
> +     }
> +     return ret;
> +}
> +
> +/* script function, returns: 1 if the transaction lifetime interval has 
> already elapsed, -1 if not */
> +int t_is_expired(struct sip_msg* msg, char* foo, char* bar)
> +{
> +     struct cell *t;
> +     int ret;
> +     
> +     
> +     if (t_check( msg , 0 )==-1) return -1;
> +     t=get_t();
> +     if ((t==0) || (t==T_UNDEFINED)){
> +             LOG(L_ERR, "ERROR: t_is_expired: cannot check a message "
> +                     "for which no T-state has been established\n");
> +             ret=-1;
> +     }else{
> +             ret=((s_ticks_t)(t->end_of_life-get_ticks_raw())>0)?-1:1;
>       }
>       return ret;
>  }

_______________________________________________
Serdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/serdev

Reply via email to