more debugging features for ref_bitmapping
authorJiri Kuthan <jiri@iptel.org>
Fri, 11 Jan 2002 23:10:46 +0000 (23:10 +0000)
committerJiri Kuthan <jiri@iptel.org>
Fri, 11 Jan 2002 23:10:46 +0000 (23:10 +0000)
Makefile.defs
modules/tm/lock.c
modules/tm/t_funcs.h
modules/tm/t_lookup.c
test/tx.cfg
udp_server.c

index 5ce56d9..4d632eb 100644 (file)
@@ -54,7 +54,7 @@ ARCH = $(shell uname -s)
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
         -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
        -DEXTRA_DEBUG \
 DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
         -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
        -DEXTRA_DEBUG \
-       -DDBG_QM_MALLOC -DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
+       -DVQ_MALLOC  -DDBG_LOCK  #-DSTATS
          #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
          #-DNO_DEBUG #-DDBG_QM_MALLOC
 #-DEXTRA_DEBUG
          #-DDBG_QM_MALLOC #-DVQ_MALLOC #-DNO_DEBUG
          #-DNO_DEBUG #-DDBG_QM_MALLOC
 #-DEXTRA_DEBUG
index 6fc8882..e6d0894 100644 (file)
@@ -194,7 +194,7 @@ inline int _unlock( ser_lock_t s )
 #endif
 {
 #ifdef DBG_LOCK
 #endif
 {
 #ifdef DBG_LOCK
-       DBG("DEBUG: lock : entered from %s, %s:%d\n", file, function, line );
+       DBG("DEBUG: unlock : entered from %s, %s:%d\n", file, function, line );
 #endif
        return change_semaphore( s, +1 );
 }
 #endif
        return change_semaphore( s, +1 );
 }
index cfbb272..096f3cb 100644 (file)
@@ -62,12 +62,13 @@ extern struct s_table*  hash_table;
                
 
 #ifdef EXTRA_DEBUG
                
 
 #ifdef EXTRA_DEBUG
+#define T_IS_REFED_BYSELF(_T_cell) ((_T_cell)->ref_bitmap & process_bit)
 #      define DBG_REF(_action, _t) DBG("DEBUG: XXXXX %s (%s:%d): T=%p , ref (bm=%x, cnt=%d)\n",\
                        (_action), __FUNCTION__, __LINE__, (_t),(_t)->ref_bitmap, T_REFCOUNTER(_t));
 #      define T_UNREF(_T_cell) \
        ( { \
                DBG_REF("unref", (_T_cell)); \
 #      define DBG_REF(_action, _t) DBG("DEBUG: XXXXX %s (%s:%d): T=%p , ref (bm=%x, cnt=%d)\n",\
                        (_action), __FUNCTION__, __LINE__, (_t),(_t)->ref_bitmap, T_REFCOUNTER(_t));
 #      define T_UNREF(_T_cell) \
        ( { \
                DBG_REF("unref", (_T_cell)); \
-               if (!T_IS_REFED(_T_cell)) { \
+               if (!T_IS_REFED_BYSELF(_T_cell)) { \
                        DBG("ERROR: unrefering unrefered transaction %p from %s , %s : %d\n", \
                                (_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
                        abort(); \
                        DBG("ERROR: unrefering unrefered transaction %p from %s , %s : %d\n", \
                                (_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
                        abort(); \
@@ -78,7 +79,7 @@ extern struct s_table*  hash_table;
 #      define T_REF(_T_cell) \
        ( { \
                DBG_REF("ref", (_T_cell));       \
 #      define T_REF(_T_cell) \
        ( { \
                DBG_REF("ref", (_T_cell));       \
-               if (T_IS_REFED(_T_cell)) { \
+               if (T_IS_REFED_BYSELF(_T_cell)) { \
                        DBG("ERROR: refering already refered transaction %p from %s , %s : %d\n", \
                                (_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
                        abort(); \
                        DBG("ERROR: refering already refered transaction %p from %s , %s : %d\n", \
                                (_T_cell), __FUNCTION__, __FILE__, __LINE__ ); \
                        abort(); \
index e13e230..228aef8 100644 (file)
@@ -319,49 +319,47 @@ nomatch2:
   */
 int t_check( struct sip_msg* p_msg , int *param_branch)
 {
   */
 int t_check( struct sip_msg* p_msg , int *param_branch)
 {
-   int local_branch;
-
-   /* is T still up-to-date ? */
-   DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T=%p\n", p_msg->id,global_msg_id,T);
-   if ( p_msg->id != global_msg_id || T==T_UNDEFINED )
-   {
-      global_msg_id = p_msg->id;
-       /*
-      if ( T && T!=T_UNDEFINED )
-         unref_T(T);
-       */
-      T = T_UNDEFINED;
-      /* transaction lookup */
-     if ( p_msg->first_line.type==SIP_REQUEST ) {
-
-               /* force parsing all the needed headers*/
-               if (parse_headers(p_msg, HDR_EOH )==-1)
-               return -1;
-         t_lookup_request( p_msg );
-        } else {
-                if ( parse_headers(p_msg, HDR_VIA1|HDR_VIA2|HDR_TO|HDR_CSEQ )==-1 ||
-                       !p_msg->via1 || !p_msg->via2 || !p_msg->to || !p_msg->cseq )
-               return -1;
-
-         t_reply_matching( p_msg , ((param_branch!=0)?(param_branch):(&local_branch)) );
-        }
-#ifdef EXTRA_DEBUG
-       if ( T && T!=T_UNDEFINED && T->damocles) {
-               LOG( L_ERR, "ERROR: transaction %p scheduled for deletion and called from t_check\n", T);
-               abort();
+       int local_branch;
+
+       /* is T still up-to-date ? */
+       DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T on entrance=%p\n", 
+               p_msg->id,global_msg_id,T);
+       if ( p_msg->id != global_msg_id || T==T_UNDEFINED )
+       {
+               global_msg_id = p_msg->id;
+               /* if ( T && T!=T_UNDEFINED ) unref_T(T); */
+               T = T_UNDEFINED;
+               /* transaction lookup */
+               if ( p_msg->first_line.type==SIP_REQUEST ) {
+
+                       /* force parsing all the needed headers*/
+                       if (parse_headers(p_msg, HDR_EOH )==-1)
+                               return -1;
+                       t_lookup_request( p_msg );
+               } else {
+                       if ( parse_headers(p_msg, HDR_VIA1|HDR_VIA2|HDR_TO|HDR_CSEQ )==-1 ||
+                               !p_msg->via1 || !p_msg->via2 || !p_msg->to || !p_msg->cseq )
+                       return -1;
+                       t_reply_matching( p_msg , ((param_branch!=0)?(param_branch):(&local_branch)) );
+               }
+#              ifdef EXTRA_DEBUG
+               if ( T && T!=T_UNDEFINED && T->damocles) {
+                       LOG( L_ERR, "ERROR: transaction %p scheduled for deletion "
+                               "and called from t_check\n", T);
+                       abort();
+               }
+#              endif
+               DBG("DEBUG: t_check : msg id=%d , global msg id=%d , T on finish=%p\n", 
+                       p_msg->id,global_msg_id,T);
+
+       } else {
+               if (T)
+                       DBG("DEBUG: t_check: T alredy found!\n");
+               else
+                       DBG("DEBUG: t_check: T previously sought and not found\n");
        }
        }
-#endif
-
-   }
-   else
-   {
-      if (T)
-         DBG("DEBUG: t_check: T alredy found!\n");
-      else
-          DBG("DEBUG: t_check: T previously sought and not found\n");
-   }
 
 
-   return ((T)?1:0) ;
+       return ((T)?1:0) ;
 }
 
 
 }
 
 
index 031c0c6..94f7527 100644 (file)
@@ -4,14 +4,14 @@
 # $ID: $
 #
 
 # $ID: $
 #
 
-debug=9          # debug level (cmd line: -dddddddddd)
+debug=4          # debug level (cmd line: -dddddddddd)
 fork=yes          # (cmd. line: -D)
 #fork=no
 log_stderror=yes # (cmd line: -E)
 #log_stderror=no       # (cmd line: -E)
 
 
 fork=yes          # (cmd. line: -D)
 #fork=no
 log_stderror=yes # (cmd line: -E)
 #log_stderror=no       # (cmd line: -E)
 
 
-children=4
+children=2
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
index 7ded288..9fe2662 100644 (file)
@@ -234,7 +234,7 @@ int udp_send(char *buf, unsigned len, struct sockaddr*  to, unsigned tolen)
 
        DBG(" destination: IP=%s, port=%u; packet:\n", ip_txt, p);
        DBG(" destination (hex): IP=%x, port=%x;\n", a->sin_addr.s_addr, a->sin_port );
 
        DBG(" destination: IP=%s, port=%u; packet:\n", ip_txt, p);
        DBG(" destination (hex): IP=%x, port=%x;\n", a->sin_addr.s_addr, a->sin_port );
-       DBG(" packet: {%*s...}\n", 24, buf );
+       /* DBG(" packet: {%*s...}\n", 24, buf ); */
        /* DBG("%*s\n", len, buf ); */
 #endif
 /*
        /* DBG("%*s\n", len, buf ); */
 #endif
 /*