[sr-dev] git:tmp/ruri_branch: tm: use ruri for forking only if marked as "new"

Andrei Pelinescu-Onciul andrei at iptel.org
Thu May 27 11:08:17 CEST 2010


Module: sip-router
Branch: tmp/ruri_branch
Commit: 22f1b9940dc6c0d162f11f6f82bbc33db21aecb2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=22f1b9940dc6c0d162f11f6f82bbc33db21aecb2

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Thu May 27 10:58:36 2010 +0200

tm: use ruri for forking only if marked as "new"

The r-uri is now used for forking only if marked as "new".
After using it, it will be automatically marked as "consumed", so
that it won't be used in the future (unless re-marked as new by
changing the r-uri, dst_uri or path).
This will simplify a lot serial forking via the script
(only seturi(...); t_relay() is needed now, no messing with
append_branch() is required anymore, unless parallel forking is desired)

---

 modules/tm/t_fwd.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index cc22096..5a8df8a 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -1328,11 +1328,9 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 		branch_route = 0;
 	}
 	
-	/* on first-time forwarding, use current uri, later only what
-	   is in additional branches (which may be continuously refilled
-	*/
-	if (first_branch==0) {
 #ifdef POSTPONE_MSG_CLONING
+	/* on first-time forwarding, update the lumps */
+	if (first_branch==0) {
 		/* update the shmem-ized msg with the lumps */
 		if ((is_route_type(REQUEST_ROUTE)) &&
 			save_msg_lumps(t->uas.request, p_msg)) {
@@ -1340,7 +1338,13 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg ,
 					"failed to save the message lumps\n");
 				return -1;
 			}
+	}
 #endif
+	/* if ruri is not already consumed (by another invocation), use current
+	   uri too. Else add only additional branches (which may be continuously
+	   refilled).
+	*/
+	if (ruri_get_forking_state()) {
 		try_new=1;
 		branch_ret=add_uac( t, p_msg, GET_RURI(p_msg), GET_NEXT_HOP(p_msg),
 							&p_msg->path_vec, proxy, p_msg->force_send_socket,




More information about the sr-dev mailing list