Module: sip-router Branch: master Commit: 1a43484b132393a10f1530f7e71cc190eacaf56a URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1a43484b...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Tue Jul 14 14:49:05 2009 +0200
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).
---
modules_k/tmx/tmx_mod.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/modules_k/tmx/tmx_mod.c b/modules_k/tmx/tmx_mod.c index c84cff7..5b8cd9c 100644 --- a/modules_k/tmx/tmx_mod.c +++ b/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)