浏览代码

Merge pull request #732 from gaaf/tm-fixes

TM fixes for DNS failover and branch_idx
Daniel-Constantin Mierla 9 年之前
父节点
当前提交
41477be7ff
共有 2 个文件被更改,包括 5 次插入0 次删除
  1. 4 0
      modules/tm/t_fwd.c
  2. 1 0
      modules/tm/t_reply.c

+ 4 - 0
modules/tm/t_fwd.c

@@ -1019,6 +1019,10 @@ int add_uac_dns_fallback(struct cell *t, struct sip_msg* msg,
 			/* copy the dns handle into the new uac */
 			dns_srv_handle_cpy(&t->uac[t->nr_of_outgoings].dns_h,
 								&old_uac->dns_h);
+			/* copy the onreply and onfailure routes */
+			t->uac[t->nr_of_outgoings].on_failure = old_uac->on_failure;
+			t->uac[t->nr_of_outgoings].on_reply = old_uac->on_reply;
+			t->uac[t->nr_of_outgoings].on_branch_failure = old_uac->on_branch_failure;
 
 			if (cfg_get(tm, tm_cfg, reparse_on_dns_failover)){
 				/* Reuse the old buffer and only replace the via header.

+ 1 - 0
modules/tm/t_reply.c

@@ -1352,6 +1352,7 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code,
 
 		drop_replies = failure_reply_mode;
 		replies_dropped = 0;
+		tm_ctx_set_branch_index(picked_branch);
 		/* run ON_FAILURE handlers ( route and callbacks) */
 		if (unlikely(has_tran_tmcbs( Trans, TMCB_ON_FAILURE_RO|TMCB_ON_FAILURE)
 						|| Trans->uac[picked_branch].on_failure )) {