Преглед на файлове

tmx(k): updated to the which_cancel change

- updated to the which_cancel name change
- use the new prepare_to_cancel skip_branches parameter to skip
  the current branch when generating the CANCEL, instead of the
  previous unsafe way (in sr which_cancel/prepare_to_cancel is
  lockless and so it's not safe to directly manipulate the cancel
  buffers even if the reply lock is held).
Andrei Pelinescu-Onciul преди 16 години
родител
ревизия
1a43484b13
променени са 1 файла, в които са добавени 7 реда и са изтрити 7 реда
  1. 7 7
      modules_k/tmx/tmx_mod.c

+ 7 - 7
modules_k/tmx/tmx_mod.c

@@ -232,11 +232,9 @@ static int t_cancel_branches(struct sip_msg* msg, char *k, char *s2)
 	switch(n) {
 		case 1:
 			LOCK_REPLIES(t);
-			_tmx_tmb.which_cancel(t, &cb);
-			if(t->uac[idx].local_cancel.buffer==BUSY_BUFFER)
-				t->uac[idx].local_cancel.buffer=NULL;
+			/* prepare cancel for every branch except idx */
+			_tmx_tmb.prepare_to_cancel(t, &cb, 1<<idx);
 			UNLOCK_REPLIES(t);
-			cb &= ~(1<<idx);
 		case 2:
 			if(msg->first_line.u.reply.statuscode>=200)
 				break;
@@ -244,10 +242,12 @@ static int t_cancel_branches(struct sip_msg* msg, char *k, char *s2)
 		break;
 		default:
 			LOCK_REPLIES(t);
-			_tmx_tmb.which_cancel(t, &cb);
-			UNLOCK_REPLIES(t);
 			if (msg->first_line.u.reply.statuscode>=200)
-				cb &= ~(1<<idx);
+				/* prepare cancel for every branch except idx */
+				_tmx_tmb.prepare_to_cancel(t, &cb, 1<<idx);
+			else
+				_tmx_tmb.prepare_to_cancel(t, &cb, 0);
+			UNLOCK_REPLIES(t);
 	}
 	LM_DBG("canceling %d/%d\n", n, (int)cb);
 	if(cb==0)