Bogdan-Andrei Iancu пре 23 година
родитељ
комит
2f6ca7a861
4 измењених фајлова са 28 додато и 40 уклоњено
  1. 13 23
      modules/tm/h_table.c
  2. 6 7
      modules/tm/sip_msg.c
  3. 7 8
      modules/tm/t_funcs.c
  4. 2 2
      test/th-uri.cfg

+ 13 - 23
modules/tm/h_table.c

@@ -16,41 +16,35 @@ void free_cell( struct cell* dead_cell )
 	struct retrans_buff* rb;
 	char *b;
 
-	DBG("DEBUG: free_cell: start\n");
 	/* UA Server */
-	DBG("DEBUG: free_cell: inbound request %p\n",dead_cell->inbound_request);
 	release_cell_lock( dead_cell );
 	shm_lock();
 	if ( dead_cell->inbound_request )
 		sip_msg_free_unsafe( dead_cell->inbound_request );
-	DBG("DEBUG: free_cell: outbound response %p\n",dead_cell->outbound_response);
 	if (b=dead_cell->outbound_response.retr_buffer) shm_free_unsafe( b );
 
 	/* UA Clients */
 	for ( i =0 ; i<dead_cell->nr_of_outgoings;  i++ )
 	{
 		/* outbound requests*/
-		DBG("DEBUG: free_cell: outbound_request[%d] %p\n",i,dead_cell->outbound_request[i]);
 		if ( rb=dead_cell->outbound_request[i] )
-   		{
+		{
 			if (rb->retr_buffer) shm_free_unsafe( rb->retr_buffer );
-	 		dead_cell->outbound_request[i] = NULL;
-         		shm_free_unsafe( rb );
-   		}
+			dead_cell->outbound_request[i] = NULL;
+			shm_free_unsafe( rb );
+		}
 		/* outbound ACKs, if any */
 		if (rb=dead_cell->outbound_ack[i] )
 			shm_free_unsafe( rb );
-   		/* outbound requests*/
-   		DBG("DEBUG: free_cell: inbound_response[%d] %p\n",i,dead_cell->inbound_response[i]);
-   		if ( dead_cell -> inbound_response[i] )
-       		sip_msg_free_unsafe( dead_cell->inbound_response[i] );
-   	}
-   	/* mutex */
-   	/* release_cell_lock( dead_cell ); */
-   	/* the cell's body */
-   	shm_free_unsafe( dead_cell );
+		/* outbound requests*/
+		if ( dead_cell -> inbound_response[i] )
+		sip_msg_free_unsafe( dead_cell->inbound_response[i] );
+	}
+	/* mutex */
+	/* release_cell_lock( dead_cell ); */
+	/* the cell's body */
+	shm_free_unsafe( dead_cell );
 	shm_unlock();
-   	DBG("DEBUG: free_cell: done\n");
 }
 
 
@@ -136,14 +130,12 @@ struct cell*  build_cell( struct sip_msg* p_msg )
    str                src[5];
    int                i;
 
-    DBG("DEBUG: build_cell : start\n");
     /* do we have the source for the build process? */
    if (!p_msg)
       return NULL;
 
    /* allocs a new cell */
    new_cell = (struct cell*)sh_malloc( sizeof( struct cell ) );
-   DBG("DEBUG: build_cell : malloc done\n");
    if  ( !new_cell )
       return NULL;
 
@@ -165,7 +157,6 @@ struct cell*  build_cell( struct sip_msg* p_msg )
    new_cell->dele_tl.payload = new_cell;
 
    new_cell->inbound_request =  sip_msg_cloner(p_msg) ;
-   DBG("DEBUG: build_cell : clone done\n");
    if (!new_cell->inbound_request)
 	goto error;
    new_cell->relaied_reply_branch   = -1;
@@ -183,7 +174,6 @@ struct cell*  build_cell( struct sip_msg* p_msg )
 
     init_cell_lock(  new_cell );
 
-   DBG("DEBUG: build_cell : done\n");
    return new_cell;
 
 error:
@@ -210,7 +200,7 @@ void    insert_into_hash_table_unsafe( struct s_table *hash_table,  struct cell
 		p_entry->last_cell->next_cell = p_cell;
 		p_cell->prev_cell = p_entry->last_cell;
 	} else p_entry->first_cell = p_cell;
-	
+
 	p_entry->last_cell = p_cell;
 }
 

+ 6 - 7
modules/tm/sip_msg.c

@@ -82,17 +82,17 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
    else
       lump_chain = org_msg->repl_add_rm;
    while (lump_chain)
-   {  
+   {
       len += lump_len( lump_chain );
       lump_tmp = lump_chain->before;
       while ( lump_tmp )
-      {  
+      {
          len += lump_len( lump_tmp );
          lump_tmp = lump_tmp->before;
       }
       lump_tmp = lump_chain->after;
       while ( lump_tmp )
-      {  
+      {
          len += lump_len( lump_tmp );
          lump_tmp = lump_tmp->after;
       }
@@ -270,13 +270,13 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
       lump_anchor = &(new_msg->repl_add_rm);
    }
    while (lump_chain)
-   {  
+   {
       lump_clone( (*lump_anchor) , lump_chain , p );
       /*before list*/
       lump_tmp = lump_chain->before;
       lump_anchor2 = &((*lump_anchor)->before);
       while ( lump_tmp )
-      {  
+      {
          lump_clone( (*lump_anchor2) , lump_tmp , p );
          lump_anchor2 = &((*lump_anchor2)->before);
          lump_tmp = lump_tmp->before;
@@ -285,7 +285,7 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
       lump_tmp = lump_chain->after;
       lump_anchor2 = &((*lump_anchor)->after);
       while ( lump_tmp )
-      {  
+      {
          lump_clone( (*lump_anchor2) , lump_tmp , p );
          lump_anchor2 = &((*lump_anchor2)->after);
          lump_tmp = lump_tmp->after;
@@ -307,7 +307,6 @@ struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg )
        (*rpl_lump_anchor)->next=0;
        rpl_lump_anchor = &((*rpl_lump_anchor)->next);
    }
-    DBG("DEBUG:cloner --------<%d>---------<%d>-------------\n",len,p-foo);
    return new_msg;
 }
 

+ 7 - 8
modules/tm/t_funcs.c

@@ -1036,12 +1036,13 @@ int t_build_and_send_ACK( struct cell *Trans, unsigned int branch, struct sip_ms
    len += CRLF_LEN; /*new line*/
 
    /* ack_buf = (char *)pkg_malloc( len +1); */
-	srb = (struct retrans_buff *) sh_malloc( sizeof(struct retrans_buff) + len + 1 );
-	if (!srb) {
-		LOG(L_ERR, "ERROR: t_build_and_send_ACK: cannot allocate memory\n");
-		goto error1;
-	}
-	ack_buf = (char *) srb + sizeof(struct retrans_buff);
+   srb = (struct retrans_buff *) sh_malloc(
+          sizeof(struct retrans_buff) + len +1 );
+   if (!srb) {
+      LOG(L_ERR, "ERROR: t_build_and_send_ACK: cannot allocate memory\n");
+     goto error1;
+    }
+    ack_buf = (char *) srb + sizeof(struct retrans_buff);
 
    p = ack_buf;
    DBG("DEBUG: t_build_and_send_ACK: len = %d \n",len);
@@ -1062,10 +1063,8 @@ int t_build_and_send_ACK( struct cell *Trans, unsigned int branch, struct sip_ms
    }
 
    *(p++) = ' ';
-
    memcpy( p , p_msg->orig+(p_msg->first_line.u.request.version.s-p_msg->buf) , p_msg->first_line.u.request.version.len );
    p += p_msg->first_line.u.request.version.len;
-
    memcpy( p, CRLF, CRLF_LEN );
    p+=CRLF_LEN;
 

+ 2 - 2
test/th-uri.cfg

@@ -32,7 +32,7 @@ loadmodule "modules/sl/sl.so"
 loadmodule "modules/cpl/cpl.so"
 
 
-route{    /*
+route{
              sl_filter_ACK();
 
              if ( mf_is_maxfwd_present() )
@@ -49,7 +49,7 @@ route{    /*
              }else{
                    mf_add_maxfwd_header( "10" );
              };
-                 */
+                 
 
              /*
              if (method=="INVITE")