Browse code

*** empty log message ***

Bogdan-Andrei Iancu authored on 25/01/2002 02:50:01
Showing 4 changed files
... ...
@@ -66,8 +66,8 @@ DEFS+= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
66 66
 #-DNO_LOG
67 67
 
68 68
 #PROFILE=  -pg #set this if you want profiling
69
-#mode = debug
70
-mode = release
69
+mode = debug
70
+#mode = release
71 71
 
72 72
 # platform dependent settings
73 73
 
... ...
@@ -532,7 +532,7 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
532 532
                    break;
533 533
       }
534 534
    }
535
-   /* length of the data lump structures
535
+   /* length of the data lump structures */
536 536
    if (org_msg->first_line.type==SIP_REQUEST)
537 537
       lump_chain = org_msg->add_rm;
538 538
    else
... ...
@@ -554,7 +554,6 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
554 554
       }
555 555
       lump_chain = lump_chain->next;
556 556
    }
557
-    */
558 557
 
559 558
    p=(char *)sh_malloc(len);
560 559
    if (!p)
... ...
@@ -679,7 +678,7 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
679 678
 
680 679
    }
681 680
 
682
-   /* clonning data lump
681
+   /* clonning data lump */
683 682
    if (org_msg->first_line.type==SIP_REQUEST) {
684 683
       lump_chain = org_msg->add_rm;
685 684
       lump_anchor = &(new_msg->add_rm);
... ...
@@ -690,7 +689,7 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
690 689
    while (lump_chain)
691 690
    {
692 691
       lump_clone( (*lump_anchor) , lump_chain , p );
693
-      /*before list/
692
+      /*before list*/
694 693
       lump_tmp = lump_chain->before;
695 694
       lump_anchor2 = &((*lump_anchor)->before);
696 695
       while ( lump_tmp )
... ...
@@ -699,7 +698,7 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
699 698
          lump_anchor2 = &((*lump_anchor2)->before);
700 699
          lump_tmp = lump_tmp->before;
701 700
       }
702
-      /*after list/
701
+      /*after list*/
703 702
       lump_tmp = lump_chain->after;
704 703
       lump_anchor2 = &((*lump_anchor)->after);
705 704
       while ( lump_tmp )
... ...
@@ -710,7 +709,7 @@ struct sip_msg*  sip_msg_cloner_2( struct sip_msg *org_msg )
710 709
       }
711 710
       lump_anchor = &((*lump_anchor)->next);
712 711
       lump_chain = lump_chain->next;
713
-   }      */
712
+   }     
714 713
 
715 714
    return new_msg;
716 715
 }
... ...
@@ -50,7 +50,7 @@ static inline void reset_timer( struct s_table *hash_table,
50 50
 static inline void reset_retr_timers( struct s_table *h_table,
51 51
 	struct cell *p_cell )
52 52
 {
53
-	int ijk; 
53
+	int ijk;
54 54
 	struct retrans_buff *rb;
55 55
 
56 56
 	DBG("DEBUG:stop_RETR_and_FR_timers : start \n");
... ...
@@ -190,11 +190,11 @@ int t_forward( struct sip_msg* p_msg , unsigned int dest_ip_param , unsigned int
190 190
 {
191 191
 	unsigned int dest_ip     = dest_ip_param;
192 192
 	unsigned int dest_port  = dest_port_param;
193
-	int	branch;
193
+	int	      branch;
194 194
 	unsigned int len;
195
-   	char               *buf, *shbuf;
195
+	char              *buf, *shbuf;
196 196
 	struct retrans_buff *rb;
197
-
197
+               struct cell         *T_source;
198 198
 
199 199
 	buf=NULL;
200 200
 	shbuf = NULL;
... ...
@@ -217,6 +217,7 @@ int t_forward( struct sip_msg* p_msg , unsigned int dest_ip_param , unsigned int
217 217
 		return 1;
218 218
 	}
219 219
 
220
+               T_source = T;
220 221
 	/* if it's forwarded for the first time ; else the request is retransmited
221 222
 	 * from the transaction buffer
222 223
 	 * when forwarding an ACK, this condition will be all the time false because
... ...
@@ -245,10 +246,11 @@ int t_forward( struct sip_msg* p_msg , unsigned int dest_ip_param , unsigned int
245 246
 						to.sin_addr.s_addr;
246 247
 					dest_port = T->T_canceled->outbound_request[branch]->
247 248
 						to.sin_port;
249
+					T_source = T->T_canceled;
248 250
 				} else { /* transaction exists, but nothing to cancel */
249
-               				DBG("DEBUG: t_forward: it's CANCEL but "
250
-					"I have nothing to cancel here\n");
251
-				/* continue forwarding CANCEL as a stand-alone transaction */
251
+					DBG("DEBUG: t_forward: it's CANCEL but "
252
+						"I have nothing to cancel here\n");
253
+					/* continue forwarding CANCEL as a stand-alone transaction */
252 254
 				}
253 255
 			} else { /* transaction does not exists  */
254 256
 				DBG("DEBUG: t_forward: canceled request not found! "
... ...
@@ -256,9 +258,9 @@ int t_forward( struct sip_msg* p_msg , unsigned int dest_ip_param , unsigned int
256 258
 			}
257 259
 		}/* end special case CANCEL*/
258 260
 
259
-		if ( add_branch_label( T, T->inbound_request , branch )==-1)
261
+		if ( add_branch_label( T_source, T->inbound_request , branch )==-1)
260 262
 			goto error;
261
-		if ( add_branch_label( T, p_msg , branch )==-1)
263
+		if ( add_branch_label( T_source, p_msg , branch )==-1)
262 264
 			goto error;
263 265
 		if ( !(buf = build_req_buf_from_sip_req  ( p_msg, &len)))
264 266
 			goto error;
... ...
@@ -315,14 +317,14 @@ int t_forward( struct sip_msg* p_msg , unsigned int dest_ip_param , unsigned int
315 317
 	} else /* if we are forwarding a CANCEL*/
316 318
 	if (  p_msg->REQ_METHOD==METHOD_CANCEL )
317 319
 	{
318
-		DBG("DEBUG: t_forward: forwarding CANCEL\n");
320
+		DBG("DEBUG: t_forward: forwarding CANCEL \n");
319 321
 		/* if no transaction to CANCEL
320 322
 		  or if the canceled transaction has a final status -> drop the CANCEL*/
321
-		if ( T->T_canceled==T_NULL || T->T_canceled->status>=200)
323
+		if ( T->T_canceled!=T_NULL && T->T_canceled->status>=200)
322 324
 		{
323 325
 			reset_timer( hash_table, &(rb->fr_timer ));
324 326
 			reset_timer( hash_table, &(rb->retr_timer ));
325
-		return 1;
327
+			return 1;
326 328
 		}
327 329
 	}
328 330
 
... ...
@@ -420,7 +422,6 @@ int t_on_reply_received( struct sip_msg  *p_msg )
420 422
 	if (!T->inbound_response[branch] && msg_class==1
421 423
 	 && T->inbound_request->REQ_METHOD==METHOD_INVITE )
422 424
 		set_timer( hash_table, &(rb->fr_timer), FR_INV_TIMER_LIST );
423
-
424 425
 	/* get response for INVITE */
425 426
 	if ( T->inbound_request->REQ_METHOD==METHOD_INVITE )
426 427
 	{
... ...
@@ -475,7 +476,6 @@ int t_on_reply_received( struct sip_msg  *p_msg )
475 476
 	}
476 477
 
477 478
 	/* nothing to do for the ser core */
478
-	/* t_unref( p_msg, NULL, NULL ); */
479 479
 	T_UNREF( T );
480 480
 	return 0;
481 481
 
... ...
@@ -302,10 +302,10 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch )
302 302
 
303 303
    /* sanity check */
304 304
    if (hash_index<0 || hash_index >=TABLE_ENTRIES ||
305
-       entry_label<0 || branch_id<0 || branch_id>=MAX_FORK ) {
306
-			DBG("DBG: t_reply_matching: snaity check failed\n");
307
-          	goto nomatch2;
308
-	}
305
+    entry_label<0 || branch_id<0 || branch_id>=MAX_FORK ) {
306
+          DBG("DBG: t_reply_matching: snaity check failed\n");
307
+         goto nomatch2;
308
+   }
309 309
 
310 310
    /* lock the hole entry*/
311 311
    lock( hash_table->entrys[hash_index].mutex );
... ...
@@ -317,22 +317,22 @@ int t_reply_matching( struct sip_msg *p_msg , unsigned int *p_branch )
317 317
    {
318 318
       /* is it the cell with the wanted entry_label? */
319 319
       if ( p_cell->label == entry_label )
320
-      /* has the transaction the wanted branch? */
321
-      if ( p_cell->nr_of_outgoings>branch_id && p_cell->outbound_request[branch_id] )
322
-      {/* WE FOUND THE GOLDEN EGG !!!! */
323
-          T = p_cell;
324
-          *p_branch = branch_id;
325
-          /* T->ref_counter ++; */
326
-		  /* ref_T( T ); */
327
-			T_REF( T );
328
-          unlock( hash_table->entrys[hash_index].mutex );
329
-          DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_reply_matching: reply matched (T=%p, ref=%x)!\n",T,T->ref_bitmap);
330
-        return 1;
331
-      }
320
+         /* has the transaction the wanted branch? */
321
+         if ( p_cell->nr_of_outgoings>branch_id && p_cell->outbound_request[branch_id] )
322
+         {/* WE FOUND THE GOLDEN EGG !!!! */
323
+             T = p_cell;
324
+             if ( *(get_cseq(p_msg)->method.s)=='C' && p_cell->T_canceler &&
325
+                p_cell->inbound_request->first_line.u.request.method_value!=METHOD_CANCEL)
326
+                T = T->T_canceler ;
327
+             *p_branch = branch_id;
328
+             T_REF( T );
329
+             unlock( hash_table->entrys[hash_index].mutex );
330
+             DBG("DEBUG:XXXXXXXXXXXXXXXXXXXXX t_reply_matching: reply matched (T=%p, ref=%x)!\n",T,T->ref_bitmap);
331
+            return 1;
332
+         }
332 333
       /* next cell */
333 334
       tmp_cell = p_cell;
334 335
       p_cell = p_cell->next_cell;
335
-
336 336
    } /* while p_cell */
337 337
 
338 338
    /* nothing found */