Mercurial > hg > freeDiameter
changeset 1212:c38bb8b69c43
Fix message rtd handling for extensions based on this data
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 17 Jun 2013 18:19:53 +0800 |
parents | 98478a8aabb1 |
children | b1c4876b1896 |
files | extensions/dbg_interactive/messages.i include/freeDiameter/libfdproto.h libfdcore/routing_dispatch.c libfdproto/messages.c |
diffstat | 4 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/dbg_interactive/messages.i Mon Jun 17 09:47:00 2013 +0800 +++ b/extensions/dbg_interactive/messages.i Mon Jun 17 18:19:53 2013 +0800 @@ -341,7 +341,7 @@ } void set_rtd(struct rt_data *DISOWN) { struct rt_data * r = DISOWN; - int ret = fd_msg_rt_associate($self, &r); + int ret = fd_msg_rt_associate($self, r); if (ret != 0) { DI_ERROR(ret, NULL, NULL); }
--- a/include/freeDiameter/libfdproto.h Mon Jun 17 09:47:00 2013 +0800 +++ b/include/freeDiameter/libfdproto.h Mon Jun 17 18:19:53 2013 +0800 @@ -2501,7 +2501,7 @@ * 0 : ok * EINVAL: a parameter is invalid */ -int fd_msg_rt_associate( struct msg * msg, struct rt_data ** rtd ); +int fd_msg_rt_associate( struct msg * msg, struct rt_data * rtd ); int fd_msg_rt_get ( struct msg * msg, struct rt_data ** rtd ); /*
--- a/libfdcore/routing_dispatch.c Mon Jun 17 09:47:00 2013 +0800 +++ b/libfdcore/routing_dispatch.c Mon Jun 17 18:19:53 2013 +0800 @@ -942,6 +942,9 @@ /* Go to next AVP */ CHECK_FCT( fd_msg_browse(avp, MSG_BRW_NEXT, &avp, NULL) ); } + + /* Save the routing information in the message */ + CHECK_FCT( fd_msg_rt_associate ( msgptr, rtd ) ); } /* Note: we reset the scores and pass the message to the callbacks, maybe we could re-use the saved scores when we have received an error ? -- TODO */ @@ -985,9 +988,6 @@ /* Order the candidate peers by score attributed by the callbacks */ CHECK_FCT( fd_rtd_candidate_reorder(candidates) ); - /* Save the routing information in the message */ - CHECK_FCT( fd_msg_rt_associate ( msgptr, &rtd ) ); - /* Now try sending the message */ for (li = candidates->prev; li != candidates; li = li->prev) { struct fd_peer * peer;
--- a/libfdproto/messages.c Mon Jun 17 09:47:00 2013 +0800 +++ b/libfdproto/messages.c Mon Jun 17 18:19:53 2013 +0800 @@ -1297,14 +1297,13 @@ } /* Associate routing lists */ -int fd_msg_rt_associate( struct msg * msg, struct rt_data ** rtd ) +int fd_msg_rt_associate( struct msg * msg, struct rt_data * rtd ) { TRACE_ENTRY( "%p %p", msg, rtd ); CHECK_PARAMS( CHECK_MSG(msg) && rtd ); - msg->msg_rtdata = *rtd; - *rtd = NULL; + msg->msg_rtdata = rtd; return 0; } @@ -1316,7 +1315,6 @@ CHECK_PARAMS( CHECK_MSG(msg) && rtd ); *rtd = msg->msg_rtdata; - msg->msg_rtdata = NULL; return 0; }