Browse code

- cleanup: e2e_cancel() sets the cancel transaction label to be the same as the invite one only if E2E_CANCEL_HOP_BY_HOP is not defined. This is not a bugfix, because even if the labels are the same and the cancel is sent hop by hop there won't be any problem: the upstream cancel replies will match only the invite transaction and not the cancel, because the cancel transaction always has 0 branches in this case (it's used only for sending a reply back downstream). Related to SER-346.

Andrei Pelinescu-Onciul authored on 27/02/2008 22:21:25
Showing 1 changed files
... ...
@@ -533,9 +533,19 @@ void e2e_cancel( struct sip_msg *cancel_msg,
533 533
 	
534 534
 	/* determine which branches to cancel ... */
535 535
 	which_cancel( t_invite, &cancel_bm );
536
-	/* fix label -- it must be same for reply matching */
537
-	t_cancel->label=t_invite->label;
538 536
 #ifdef E2E_CANCEL_HOP_BY_HOP
537
+	/* we don't need to set t_cancel label to be the same as t_invite if
538
+	 * we do hop by hop cancel. The cancel transaction will have a different 
539
+	 * label, but this is not a problem since this transaction is only used to
540
+	 * send a reply back. The cancels sent upstream will be part of the invite
541
+	 * transaction (local_cancel retr. bufs) and they will be generated with
542
+	 * the same via as the invite.
543
+	 * Note however that setting t_cancel label the same as t_invite will work
544
+	 * too (the upstream cancel replies will properly match the t_invite
545
+	 * transaction and will not match the t_cancel because t_cancel will always
546
+	 * have 0 branches and we check for the branch number in 
547
+	 * t_reply_matching() ).
548
+	 */
539 549
 	for (i=0; i<t_invite->nr_of_outgoings; i++)
540 550
 		if (cancel_bm & (1<<i)) {
541 551
 			/* it's safe to get the reply lock since e2e_cancel is
... ...
@@ -546,7 +556,12 @@ void e2e_cancel( struct sip_msg *cancel_msg,
546 546
 			if (ret<0) cancel_bm &= ~(1<<i);
547 547
 			if (ret<lowest_error) lowest_error=ret;
548 548
 		}
549
-#else
549
+#else /* ! E2E_CANCEL_HOP_BY_HOP */
550
+	/* fix label -- it must be same for reply matching (the label is part of
551
+	 * the generated via branch for the cancels sent upstream and if it
552
+	 * would be different form the one in the INVITE the transactions would not
553
+	 * match */
554
+	t_cancel->label=t_invite->label;
550 555
 	t_cancel->nr_of_outgoings=t_invite->nr_of_outgoings;
551 556
 	/* ... and install CANCEL UACs */
552 557
 	for (i=0; i<t_invite->nr_of_outgoings; i++)