Module: sip-router
Branch: master
Commit: 08798a6d06b628fa5888ded867c5d18416b9f013
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=08798a6…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Wed Aug 3 19:34:09 2011 +0200
tm: allow nested backup of avp lists when sending local requests
- added ability to use a local variable instead static var to
backup/restore avps lists for local generated transactions
---
modules/tm/h_table.c | 7 +++++--
modules/tm/h_table.h | 2 +-
modules/tm/uac.c | 5 +++--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 4870920..aff447d 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -492,12 +492,15 @@ error0:
* - mode = 0 - from msg context to _txdata and use T lists
* - mode = 1 - restore to msg context from _txdata
*/
-void tm_xdata_swap(tm_cell_t *t, int mode)
+void tm_xdata_swap(tm_cell_t *t, tm_xdata_t *xd, int mode)
{
static tm_xdata_t _txdata;
tm_xdata_t *x;
- x = &_txdata;
+ if(xd==NULL)
+ x = &_txdata;
+ else
+ x = xd;
if(mode==0) {
if(t==NULL)
diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index 2ad42ce..c802ab6 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -565,7 +565,7 @@ inline static void remove_from_hash_table_unsafe( struct cell *
p_cell)
/**
* backup xdata from/to msg context to local var and use T lists
*/
-void tm_xdata_swap(tm_cell_t *t, int mode);
+void tm_xdata_swap(tm_cell_t *t, tm_xdata_t *xd, int mode);
#endif
diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index 0f36a4c..c552f5a 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -216,6 +216,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
int backup_route_type;
#endif
snd_flags_t snd_flags;
+ tm_xdata_t backup_xd;
ret=-1;
hi=0; /* make gcc happy */
@@ -353,7 +354,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
lreq.rcv.comp=dst.comp;
#endif /* USE_COMP */
sflag_bk = getsflags();
- tm_xdata_swap(new_cell, 0);
+ tm_xdata_swap(new_cell, &backup_xd, 0);
/* run the route */
backup_route_type = get_route_type();
@@ -372,7 +373,7 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
set_route_type( backup_route_type );
/* restore original environment */
- tm_xdata_swap(new_cell, 1);
+ tm_xdata_swap(new_cell, &backup_xd, 1);
setsflagsval(sflag_bk);
if (unlikely(lreq.new_uri.s))