Browse code

change to return value convention

Jiri Kuthan authored on 09/01/2002 18:50:24
Showing 9 changed files
... ...
@@ -52,7 +52,7 @@ ARCH = $(shell uname -s)
52 52
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
53 53
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
54 54
 	-DEXTRA_DEBUG \
55
-	-DVQ_MALLOC 
55
+	-DVQ_MALLOC  #-DSTATS
56 56
 	  #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
57 57
 	  #-DNO_DEBUG #-DDBG_QM_MALLOC
58 58
 #-DEXTRA_DEBUG
... ...
@@ -337,8 +337,12 @@ int do_action(struct action* a, struct sip_msg* msg)
337 337
 						LOG(L_WARN,"WARNING: do_action:"
338 338
 									"error in expression\n");
339 339
 					}
340
-					ret=1; /* default is continue */
341
-					if (v==1){
340
+					/* jku ret=1;  default is continue */
341
+					ret=( v!=0); /* stop if things went wrong,
342
+								  continue if FALSE (<0) or
343
+								  TRUE (>0) returned */
344
+					/* jku: if (v==1){ */
345
+					if (v>0) {
342 346
 						if ((a->p2_type==ACTIONS_ST)&&a->p2.data){
343 347
 							ret=run_actions((struct action*)a->p2.data, msg);
344 348
 						}
... ...
@@ -182,7 +182,12 @@ int forward_reply(struct sip_msg* msg)
182 182
 		STATS_TX_DROPS;
183 183
 		goto error;
184 184
 	}
185
-	else STATS_TX_RESPONSE(  msg->first_line.u.reply.statusclass );
185
+	else {
186
+#ifdef STATS
187
+		int j = msg->first_line.u.reply.statuscode/100;
188
+		STATS_TX_RESPONSE(  j );
189
+#endif
190
+	}
186 191
 	free(new_buf);
187 192
 	free(to);
188 193
 skip:
... ...
@@ -521,7 +521,8 @@ error:
521 521
 	t_unref( p_msg, NULL, NULL );
522 522
 	T->inbound_response[branch]=NULL;
523 523
 	sip_msg_free( clone );
524
-	return -1;
524
+	/* don't try to relay statelessly on error */
525
+	return 0;
525 526
 }
526 527
 
527 528
 
... ...
@@ -69,7 +69,8 @@ int t_lookup_request( struct sip_msg* p_msg )
69 69
    {
70 70
       LOG(L_ERR, "ERROR: TM module: t_lookup_request: too few headers\n");
71 71
       T=0;
72
-      return -1;
72
+	  /* stop processing */
73
+      return 0;
73 74
    }
74 75
 
75 76
    /* start searching into the table */
... ...
@@ -209,7 +209,7 @@ static int fixup_t_send_reply(void** param, int param_no)
209 209
 
210 210
 static int w_t_check(struct sip_msg* msg, char* str, char* str2)
211 211
 {
212
-	return t_check( msg , 0 );
212
+	return t_check( msg , 0 ) ? 1 : -1;
213 213
 }
214 214
 
215 215
 static int w_t_forward(struct sip_msg* msg, char* str, char* str2)
... ...
@@ -106,7 +106,7 @@ int receive_msg(char* buf, unsigned int len, unsigned long src_ip)
106 106
 
107 107
 #ifdef STATS
108 108
 		gettimeofday( & tvb, &tz );
109
-		STATS_RX_RESPONSE ( msg->first_line.u.reply.statusclass );
109
+		STATS_RX_RESPONSE ( msg->first_line.u.reply.statuscode / 100 );
110 110
 #endif
111 111
 		
112 112
 		/* send the msg */
... ...
@@ -4,7 +4,7 @@
4 4
 # $ID: $
5 5
 #
6 6
 
7
-debug=1          # debug level (cmd line: -dddddddddd)
7
+debug=9          # debug level (cmd line: -dddddddddd)
8 8
 check_via=yes     # (cmd. line: -v)
9 9
 dns=on           # (cmd. line: -r)
10 10
 rev_dns=yes      # (cmd. line: -R)
... ...
@@ -12,7 +12,7 @@ rev_dns=yes      # (cmd. line: -R)
12 12
 fork=no
13 13
 children=16
14 14
 log_stderror=yes # (cmd line: -E)
15
-log_stderror=no	# (cmd line: -E)
15
+#log_stderror=no	# (cmd line: -E)
16 16
 port=5080
17 17
 #listen=127.0.0.1
18 18
 listen=192.168.99.100
... ...
@@ -25,6 +25,7 @@ loadmodule "modules/print/print.so"
25 25
 
26 26
 route{
27 27
 	if ( t_lookup_request()) {
28
+		log("SER: transaction found\n");
28 29
 		if ( method=="ACK" )	{
29 30
 			log("SER: ACK received -> t_release\n");
30 31
 			if (! t_forward("bat.iptel.org", "5090" )) {
... ...
@@ -41,6 +42,7 @@ route{
41 41
 		};
42 42
 		t_unref();
43 43
 	} else {
44
+		log("SER: transaction not found\n");
44 45
 		if (method=="ACK") {
45 46
 			# no established transaction ... forward ACK just statelessly
46 47
 			forward("bat.iptel.org", 5090);
... ...
@@ -4,7 +4,7 @@
4 4
 #
5 5
 
6 6
 
7
-debug=3          # debug level (cmd line: -dddddddddd)
7
+debug=9          # debug level (cmd line: -dddddddddd)
8 8
 log_stderror=yes # (cmd line: -E)
9 9
 check_via=yes     # (cmd. line: -v)
10 10
 dns=on           # (cmd. line: -r)