Module: sip-router Branch: master Commit: 56f2823ca3cba947e968a398b96395232ee21f62 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=56f2823c...
Author: Henning Westerholt henning.westerholt@1und1.de Committer: Henning Westerholt henning.westerholt@1und1.de Date: Mon Jul 4 00:07:45 2011 +0200
tm: remove #ifdef POSTPONE_MSG_CLONING, its default for three years now
- remove POSTPONE_MSG_CLONING define from tm module - its now the default for more than three years - control flow in the module without it is better understandable - the current way is the expected behavior, also recently discussed on the list
---
modules/tm/h_table.c | 7 ------- modules/tm/sip_msg.c | 9 --------- modules/tm/sip_msg.h | 25 ++++++------------------- modules/tm/t_fwd.c | 10 ++-------- modules/tm/t_suspend.c | 2 -- modules/tm/tm.c | 9 --------- 6 files changed, 8 insertions(+), 54 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c index 991435f..743fa94 100644 --- a/modules/tm/h_table.c +++ b/modules/tm/h_table.c @@ -369,13 +369,6 @@ struct cell* build_cell( struct sip_msg* p_msg ) }
if (p_msg) { -#ifndef POSTPONE_MSG_CLONING - /* it makes no sense to clean the lumps when they are not cloned (Miklos) */ - - /* clean possible previous added vias/clen header or else they would - * get propagated in the failure routes */ - free_via_clen_lump(&p_msg->add_rm); -#endif new_cell->uas.request = sip_msg_cloner(p_msg,&sip_msg_len); if (!new_cell->uas.request) goto error; diff --git a/modules/tm/sip_msg.c b/modules/tm/sip_msg.c index ab093f8..f968acd 100644 --- a/modules/tm/sip_msg.c +++ b/modules/tm/sip_msg.c @@ -64,29 +64,21 @@ #include "../../data_lump_rpl.h" #include "../../ut.h" #include "../../sip_msg_clone.h" - -#ifdef POSTPONE_MSG_CLONING #include "../../fix_lumps.h" -#endif
/* Warning: Cloner does not clone all hdr_field headers (From, To, etc.). Pointers will reference pkg memory. Dereferencing will crash ser!!! */
struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ) { -#ifdef POSTPONE_MSG_CLONING /* take care of the lumps only for replies if the msg cloning is postponed */ if (org_msg->first_line.type==SIP_REPLY) -#endif /* POSTPONE_MSG_CLONING */ /*cloning all the lumps*/ return sip_msg_shm_clone(org_msg, sip_msg_len, 1); -#ifdef POSTPONE_MSG_CLONING /* don't clone the lumps */ return sip_msg_shm_clone(org_msg, sip_msg_len, 0); -#endif /* POSTPONE_MSG_CLONING */ }
-#ifdef POSTPONE_MSG_CLONING /* indicates wheter we have already cloned the msg lumps or not */ unsigned char lumps_are_cloned = 0;
@@ -144,4 +136,3 @@ int save_msg_lumps( struct sip_msg *shm_msg, struct sip_msg *pkg_msg) } return ret<0?-1:0; } -#endif /* POSTPONE_MSG_CLONING */ diff --git a/modules/tm/sip_msg.h b/modules/tm/sip_msg.h index 0c6a6a3..f006cde 100644 --- a/modules/tm/sip_msg.h +++ b/modules/tm/sip_msg.h @@ -42,19 +42,15 @@ * the first time. * Replies use only one memory block. */ -#define POSTPONE_MSG_CLONING
-#ifdef POSTPONE_MSG_CLONING #include "../../atomic_ops.h" /* membar_depends() */ -#endif
-#ifdef POSTPONE_MSG_CLONING - /* msg is a reply: one memory block was allocated - * msg is a request: two memory blocks were allocated: - * - one for the sip_msg struct - * - another one for the lumps which is linked to - * add_rm, body_lumps, or reply_lump. - */ +/* msg is a reply: one memory block was allocated + * msg is a request: two memory blocks were allocated: + * - one for the sip_msg struct + * - another one for the lumps which is linked to + * add_rm, body_lumps, or reply_lump. + */ #define _sip_msg_free(_free_func, _p_msg) \ do{ \ if (_p_msg->first_line.type==SIP_REPLY) { \ @@ -72,13 +68,6 @@ } \ }while(0)
-#else /* POSTPONE_MSG_CLONING */ - - /* only one memory block was allocated */ -#define _sip_msg_free(_free_func, _p_msg) \ - _free_func( (_p_msg) ) - -#endif /* POSTPONE_MSG_CLONING */
#define sip_msg_free(_p_msg) _sip_msg_free(shm_free, _p_msg) #define sip_msg_free_unsafe(_p_msg) _sip_msg_free(shm_free_unsafe, _p_msg) @@ -86,11 +75,9 @@
struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len );
-#ifdef POSTPONE_MSG_CLONING extern unsigned char lumps_are_cloned;
int save_msg_lumps( struct sip_msg *shm_msg, struct sip_msg *pkg_msg); -#endif
#endif diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c index d0e8fb9..6385812 100644 --- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -123,9 +123,8 @@ #ifdef USE_DST_BLACKLIST #include "../../dst_blacklist.h" #endif -#ifdef POSTPONE_MSG_CLONING #include "../../atomic_ops.h" /* membar_depends() */ -#endif +
static int goto_on_branch = 0, branch_route = 0;
@@ -231,11 +230,9 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req,
/* dup lumps * TODO: clone lumps only if needed */ -#ifdef POSTPONE_MSG_CLONING /* lumps can be set outside of the lock, make sure that we read * the up-to-date values */ membar_depends(); -#endif add_rm_backup = i_req->add_rm; body_lumps_backup = i_req->body_lumps; if (unlikely(i_req->add_rm)){ @@ -919,11 +916,9 @@ int e2e_cancel_branch( struct sip_msg *cancel_msg, struct cell *t_cancel, /* print */ if (cfg_get(tm, tm_cfg, reparse_invite)) { /* buffer is built localy from the INVITE which was sent out */ -#ifdef POSTPONE_MSG_CLONING /* lumps can be set outside of the lock, make sure that we read * the up-to-date values */ membar_depends(); -#endif if (cancel_msg->add_rm || cancel_msg->body_lumps) { LOG(L_WARN, "WARNING: e2e_cancel_branch: CANCEL is built locally, " "thus lumps are not applied to the message!\n"); @@ -1461,7 +1456,6 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , branch_route = 0; } -#ifdef POSTPONE_MSG_CLONING /* on first-time forwarding, update the lumps */ if (first_branch==0) { /* update the shmem-ized msg with the lumps */ @@ -1472,7 +1466,7 @@ int t_forward_nonack( struct cell *t, struct sip_msg* p_msg , 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). diff --git a/modules/tm/t_suspend.c b/modules/tm/t_suspend.c index 19c7f32..578d6b0 100644 --- a/modules/tm/t_suspend.c +++ b/modules/tm/t_suspend.c @@ -82,7 +82,6 @@ int t_suspend(struct sip_msg *msg, DBG("SER: ERROR: t_suspend (100)\n"); }
-#ifdef POSTPONE_MSG_CLONING if ((t->nr_of_outgoings==0) && /* if there had already been an UAC created, then the lumps were saved as well */ @@ -92,7 +91,6 @@ int t_suspend(struct sip_msg *msg, "failed to save the message lumps\n"); return -1; } -#endif /* save the message flags */ t->uas.request->flags = msg->flags;
diff --git a/modules/tm/tm.c b/modules/tm/tm.c index 734f093..096e30c 100644 --- a/modules/tm/tm.c +++ b/modules/tm/tm.c @@ -726,10 +726,7 @@ static int script_init( struct sip_msg *foo, unsigned int flags, void *bar) /* set request mode so that multiple-mode actions know * how to behave */ set_route_type(REQUEST_ROUTE); - -#ifdef POSTPONE_MSG_CLONING lumps_are_cloned = 0; -#endif return 1; }
@@ -1888,7 +1885,6 @@ static int w_t_drop_replies(struct sip_msg* msg, char* foo, char* bar) /* save the message lumps after t_newtran() but before t_relay() */ static int w_t_save_lumps(struct sip_msg* msg, char* foo, char* bar) { -#ifdef POSTPONE_MSG_CLONING struct cell *t;
if (is_route_type(REQUEST_ROUTE)) { @@ -1905,11 +1901,6 @@ static int w_t_save_lumps(struct sip_msg* msg, char* foo, char* bar) } } /* else nothing to do, the lumps have already been saved */ return 1; -#else - LOG(L_ERR, "ERROR: w_t_save_lumps: POSTPONE_MSG_CLONING is not defined," - " thus, the functionality is not supported\n"); - return -1; -#endif }