# HG changeset patch # User Sebastien Decugis # Date 1371530774 -28800 # Node ID 876cb3e4d738363ac5586d88b3a466af7c210f55 # Parent 1e8267ad057c1360daf0c80d519cd30882ba1fb1# Parent b1c4876b1896443a750aa12e31c051c6375796d9 Merged diff -r 1e8267ad057c -r 876cb3e4d738 extensions/dbg_interactive/messages.i --- a/extensions/dbg_interactive/messages.i Tue Jun 18 12:46:01 2013 +0800 +++ b/extensions/dbg_interactive/messages.i Tue Jun 18 12:46:14 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 1e8267ad057c -r 876cb3e4d738 include/freeDiameter/libfdproto.h --- a/include/freeDiameter/libfdproto.h Tue Jun 18 12:46:01 2013 +0800 +++ b/include/freeDiameter/libfdproto.h Tue Jun 18 12:46:14 2013 +0800 @@ -314,7 +314,12 @@ */ #ifdef DEBUG # define LOG_A(format,args... ) \ - LOG(FD_LOG_ANNOYING,format,##args) + do { if ((fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__)) \ + || (fd_debug_one_file && !strcmp(fd_debug_one_file, __STRIPPED_FILE__) ) ) { \ + LOG(FD_LOG_DEBUG,"[DBG_MATCH] " format,##args); \ + } else { \ + LOG(FD_LOG_ANNOYING,format,##args); \ + } } while (0) #else /* DEBUG */ # define LOG_A(format,args... ) /* not defined in release */ #endif /* DEBUG */ @@ -374,10 +379,7 @@ /* Helper for tracing the CHECK_* macros below -- very very verbose code execution! */ #define TRACE_CALL( str... ) \ - if ((fd_debug_one_function && !strcmp(fd_debug_one_function, __PRETTY_FUNCTION__)) \ - || (fd_debug_one_file && !strcmp(fd_debug_one_file, __STRIPPED_FILE__) ) ) { \ - LOG_A( str ); \ - } + LOG_A( str ) /* For development only, to keep track of TODO locations in the code */ #ifndef ERRORS_ON_TODO @@ -2501,7 +2503,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 1e8267ad057c -r 876cb3e4d738 libfdcore/routing_dispatch.c --- a/libfdcore/routing_dispatch.c Tue Jun 18 12:46:01 2013 +0800 +++ b/libfdcore/routing_dispatch.c Tue Jun 18 12:46:14 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 1e8267ad057c -r 876cb3e4d738 libfdproto/messages.c --- a/libfdproto/messages.c Tue Jun 18 12:46:01 2013 +0800 +++ b/libfdproto/messages.c Tue Jun 18 12:46:14 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; }