# HG changeset patch # User Sebastien Decugis # Date 1371464393 -28800 # Node ID c38bb8b69c43e0ddc421af09a340c1c9acfd1d1d # Parent 98478a8aabb17a9bd2dbb50eef7ff96cbed0e9c5 Fix message rtd handling for extensions based on this data diff -r 98478a8aabb1 -r c38bb8b69c43 extensions/dbg_interactive/messages.i --- 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); } diff -r 98478a8aabb1 -r c38bb8b69c43 include/freeDiameter/libfdproto.h --- 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 ); /* diff -r 98478a8aabb1 -r c38bb8b69c43 libfdcore/routing_dispatch.c --- 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; diff -r 98478a8aabb1 -r c38bb8b69c43 libfdproto/messages.c --- 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; }