Browse code

more debugging features for ref_bitmapping

Jiri Kuthan authored on 11/01/2002 23:10:46
Showing 6 changed files
... ...
@@ -54,7 +54,7 @@ ARCH = $(shell uname -s)
54 54
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
55 55
 	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
56 56
 	-DEXTRA_DEBUG \
57
-	-DDBG_QM_MALLOC -DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
57
+	-DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
58 58
 	  #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
59 59
 	  #-DNO_DEBUG #-DDBG_QM_MALLOC
60 60
 #-DEXTRA_DEBUG
... ...
@@ -194,7 +194,7 @@ inline int _unlock( ser_lock_t s )
194 194
 #endif
195 195
 {
196 196
 #ifdef DBG_LOCK
197
-	DBG("DEBUG: lock : entered from %s, %s:%d\n", file, function, line );
197
+	DBG("DEBUG: unlock : entered from %s, %s:%d\n", file, function, line );
198 198
 #endif
199 199
 	return change_semaphore( s, +1 );
200 200
 }
... ...
@@ -62,12 +62,13 @@ extern struct s_table*  hash_table;
62 62
 		
63 63
 
64 64
 #ifdef EXTRA_DEBUG
65
+#define T_IS_REFED_BYSELF(_T_cell) ((_T_cell)->ref_bitmap & process_bit)
65 66
 #	define DBG_REF(_action, _t) DBG("DEBUG: XXXXX %s (%s:%d): T=%p , ref (bm=%x, cnt=%d)\n",\
66 67
 			(_action), __FUNCTION__, __LINE__, (_t),(_t)->ref_bitmap, T_REFCOUNTER(_t));
67 68
 #	define T_UNREF(_T_cell) \
68 69
 	( { \
69 70
 		DBG_REF("unref", (_T_cell)); \
70
-		if (!T_IS_REFED(_T_cell)) { \
71
+		if (!T_IS_REFED_BYSELF(_T_cell)) { \
71 72
 			DBG("ERROR: unrefering unrefered transaction %p from %s , %s : %d\n", \
72 73
 				(_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
73 74
 			abort(); \
... ...
@@ -78,7 +79,7 @@ extern struct s_table*  hash_table;
78 79
 #	define T_REF(_T_cell) \
79 80
 	( { \
80 81
 		DBG_REF("ref", (_T_cell));	 \
81
-		if (T_IS_REFED(_T_cell)) { \
82
+		if (T_IS_REFED_BYSELF(_T_cell)) { \
82 83
 			DBG("ERROR: refering already refered transaction %p from %s , %s : %d\n", \
83 84
 				(_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
84 85
 			abort(); \
... ...
@@ -319,49 +319,47 @@ nomatch2:
319 319
   */
320 320
 int t_check( struct sip_msg* p_msg , int *param_branch)
321 321
 {
322
-   int local_branch;
323
-
324
-   /* is T still up-to-date ? */
325
-   DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T=%p\n", p_msg->id,global_msg_id,T);
326
-   if ( p_msg->id != global_msg_id || T==T_UNDEFINED )
327
-   {
328
-      global_msg_id = p_msg->id;
329
-	/*
330
-      if ( T && T!=T_UNDEFINED )
331
-         unref_T(T);
332
-	*/
333
-      T = T_UNDEFINED;
334
-      /* transaction lookup */
335
-     if ( p_msg->first_line.type==SIP_REQUEST ) {
336
-
337
-   		/* force parsing all the needed headers*/
338
-   		if (parse_headers(p_msg, HDR_EOH )==-1)
339
-    		return -1;
340
-         t_lookup_request( p_msg );
341
-	 } else {
342
-		 if ( parse_headers(p_msg, HDR_VIA1|HDR_VIA2|HDR_TO|HDR_CSEQ )==-1 ||
343
-        		!p_msg->via1 || !p_msg->via2 || !p_msg->to || !p_msg->cseq )
344
-    		return -1;
345
-
346
-         t_reply_matching( p_msg , ((param_branch!=0)?(param_branch):(&local_branch)) );
347
-	 }
348
-#ifdef EXTRA_DEBUG
349
-	if ( T && T!=T_UNDEFINED && T->damocles) {
350
-		LOG( L_ERR, "ERROR: transaction %p scheduled for deletion and called from t_check\n", T);
351
-		abort();
322
+	int local_branch;
323
+
324
+	/* is T still up-to-date ? */
325
+	DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T on entrance=%p\n", 
326
+		p_msg->id,global_msg_id,T);
327
+	if ( p_msg->id != global_msg_id || T==T_UNDEFINED )
328
+	{
329
+		global_msg_id = p_msg->id;
330
+		/* if ( T && T!=T_UNDEFINED ) unref_T(T); */
331
+      		T = T_UNDEFINED;
332
+		/* transaction lookup */
333
+		if ( p_msg->first_line.type==SIP_REQUEST ) {
334
+
335
+   			/* force parsing all the needed headers*/
336
+   			if (parse_headers(p_msg, HDR_EOH )==-1)
337
+    				return -1;
338
+         		t_lookup_request( p_msg );
339
+	 	} else {
340
+		 	if ( parse_headers(p_msg, HDR_VIA1|HDR_VIA2|HDR_TO|HDR_CSEQ )==-1 ||
341
+        			!p_msg->via1 || !p_msg->via2 || !p_msg->to || !p_msg->cseq )
342
+    			return -1;
343
+         		t_reply_matching( p_msg , ((param_branch!=0)?(param_branch):(&local_branch)) );
344
+	 	}
345
+#		ifdef EXTRA_DEBUG
346
+		if ( T && T!=T_UNDEFINED && T->damocles) {
347
+			LOG( L_ERR, "ERROR: transaction %p scheduled for deletion "
348
+				"and called from t_check\n", T);
349
+			abort();
350
+		}
351
+#		endif
352
+   		DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T on finish=%p\n", 
353
+			p_msg->id,global_msg_id,T);
354
+
355
+   	} else {
356
+		if (T)
357
+			DBG("DEBUG: t_check: T alredy found!\n");
358
+		else
359
+			DBG("DEBUG: t_check: T previously sought and not found\n");
352 360
 	}
353
-#endif
354
-
355
-   }
356
-   else
357
-   {
358
-      if (T)
359
-         DBG("DEBUG: t_check: T alredy found!\n");
360
-      else
361
-          DBG("DEBUG: t_check: T previously sought and not found\n");
362
-   }
363 361
 
364
-   return ((T)?1:0) ;
362
+	return ((T)?1:0) ;
365 363
 }
366 364
 
367 365
 
... ...
@@ -4,14 +4,14 @@
4 4
 # $ID: $
5 5
 #
6 6
 
7
-debug=9          # debug level (cmd line: -dddddddddd)
7
+debug=4          # debug level (cmd line: -dddddddddd)
8 8
 fork=yes          # (cmd. line: -D)
9 9
 #fork=no
10 10
 log_stderror=yes # (cmd line: -E)
11 11
 #log_stderror=no	# (cmd line: -E)
12 12
 
13 13
 
14
-children=4
14
+children=2
15 15
 check_via=yes     # (cmd. line: -v)
16 16
 dns=on           # (cmd. line: -r)
17 17
 rev_dns=yes      # (cmd. line: -R)
... ...
@@ -234,7 +234,7 @@ int udp_send(char *buf, unsigned len, struct sockaddr*  to, unsigned tolen)
234 234
 
235 235
 	DBG(" destination: IP=%s, port=%u; packet:\n", ip_txt, p);
236 236
 	DBG(" destination (hex): IP=%x, port=%x;\n", a->sin_addr.s_addr, a->sin_port );
237
-	DBG(" packet: {%*s...}\n", 24, buf );
237
+	/* DBG(" packet: {%*s...}\n", 24, buf ); */
238 238
 	/* DBG("%*s\n", len, buf ); */
239 239
 #endif
240 240
 /*