change to return value convention
authorJiri Kuthan <jiri@iptel.org>
Wed, 9 Jan 2002 18:50:24 +0000 (18:50 +0000)
committerJiri Kuthan <jiri@iptel.org>
Wed, 9 Jan 2002 18:50:24 +0000 (18:50 +0000)
Makefile.defs
action.c
forward.c
modules/tm/t_funcs.c
modules/tm/t_lookup.c
modules/tm/tm.c
receive.c
test/tx.cfg
test/xx.cfg

index 399dd96..0eb1db9 100644 (file)
@@ -52,7 +52,7 @@ ARCH = $(shell uname -s)
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
         -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
        -DEXTRA_DEBUG \
-       -DVQ_MALLOC 
+       -DVQ_MALLOC  #-DSTATS
          #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
          #-DNO_DEBUG #-DDBG_QM_MALLOC
 #-DEXTRA_DEBUG
index 68fbebd..2fdcb33 100644 (file)
--- a/action.c
+++ b/action.c
@@ -337,8 +337,12 @@ int do_action(struct action* a, struct sip_msg* msg)
                                                LOG(L_WARN,"WARNING: do_action:"
                                                                        "error in expression\n");
                                        }
-                                       ret=1; /* default is continue */
-                                       if (v==1){
+                                       /* jku ret=1;  default is continue */
+                                       ret=( v!=0); /* stop if things went wrong,
+                                                                 continue if FALSE (<0) or
+                                                                 TRUE (>0) returned */
+                                       /* jku: if (v==1){ */
+                                       if (v>0) {
                                                if ((a->p2_type==ACTIONS_ST)&&a->p2.data){
                                                        ret=run_actions((struct action*)a->p2.data, msg);
                                                }
index 51903e0..d14978d 100644 (file)
--- a/forward.c
+++ b/forward.c
@@ -182,7 +182,12 @@ int forward_reply(struct sip_msg* msg)
                STATS_TX_DROPS;
                goto error;
        }
-       else STATS_TX_RESPONSE(  msg->first_line.u.reply.statusclass );
+       else {
+#ifdef STATS
+               int j = msg->first_line.u.reply.statuscode/100;
+               STATS_TX_RESPONSE(  j );
+#endif
+       }
        free(new_buf);
        free(to);
 skip:
index 3c34760..f9d21ed 100644 (file)
@@ -521,7 +521,8 @@ error:
        t_unref( p_msg, NULL, NULL );
        T->inbound_response[branch]=NULL;
        sip_msg_free( clone );
-       return -1;
+       /* don't try to relay statelessly on error */
+       return 0;
 }
 
 
index 00014a5..8b99f2d 100644 (file)
@@ -69,7 +69,8 @@ int t_lookup_request( struct sip_msg* p_msg )
    {
       LOG(L_ERR, "ERROR: TM module: t_lookup_request: too few headers\n");
       T=0;
-      return -1;
+         /* stop processing */
+      return 0;
    }
 
    /* start searching into the table */
index ba40f53..22ec1bf 100644 (file)
@@ -209,7 +209,7 @@ static int fixup_t_send_reply(void** param, int param_no)
 
 static int w_t_check(struct sip_msg* msg, char* str, char* str2)
 {
-       return t_check( msg , 0 );
+       return t_check( msg , 0 ) ? 1 : -1;
 }
 
 static int w_t_forward(struct sip_msg* msg, char* str, char* str2)
index 38a1b11..4d5729c 100644 (file)
--- a/receive.c
+++ b/receive.c
@@ -106,7 +106,7 @@ int receive_msg(char* buf, unsigned int len, unsigned long src_ip)
 
 #ifdef STATS
                gettimeofday( & tvb, &tz );
-               STATS_RX_RESPONSE ( msg->first_line.u.reply.statusclass );
+               STATS_RX_RESPONSE ( msg->first_line.u.reply.statuscode / 100 );
 #endif
                
                /* send the msg */
index d08711c..7d8c4c5 100644 (file)
@@ -4,7 +4,7 @@
 # $ID: $
 #
 
-debug=1          # debug level (cmd line: -dddddddddd)
+debug=9          # debug level (cmd line: -dddddddddd)
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
@@ -12,7 +12,7 @@ rev_dns=yes      # (cmd. line: -R)
 fork=no
 children=16
 log_stderror=yes # (cmd line: -E)
-log_stderror=no        # (cmd line: -E)
+#log_stderror=no       # (cmd line: -E)
 port=5080
 #listen=127.0.0.1
 listen=192.168.99.100
@@ -25,6 +25,7 @@ loadmodule "modules/print/print.so"
 
 route{
        if ( t_lookup_request()) {
+               log("SER: transaction found\n");
                if ( method=="ACK" )    {
                        log("SER: ACK received -> t_release\n");
                        if (! t_forward("bat.iptel.org", "5090" )) {
@@ -41,6 +42,7 @@ route{
                };
                t_unref();
        } else {
+               log("SER: transaction not found\n");
                if (method=="ACK") {
                        # no established transaction ... forward ACK just statelessly
                        forward("bat.iptel.org", 5090);
index 21aa093..ab18527 100644 (file)
@@ -4,7 +4,7 @@
 #
 
 
-debug=3          # debug level (cmd line: -dddddddddd)
+debug=9          # debug level (cmd line: -dddddddddd)
 log_stderror=yes # (cmd line: -E)
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)