changeset 166:6d166f75e25a

Fix routing list scores initialization
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 28 Jan 2010 15:01:50 +0900
parents 4679ff581d6a
children 967e579beb64
files extensions/dbg_rt/dbg_rt.c libfreeDiameter/rt_data.c
diffstat 2 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/dbg_rt/dbg_rt.c	Wed Jan 27 10:56:54 2010 +0900
+++ b/extensions/dbg_rt/dbg_rt.c	Thu Jan 28 15:01:50 2010 +0900
@@ -63,11 +63,11 @@
 	
 	fd_log_debug("[dbg_rt] OUT routing message: %p\n", msg);
 	fd_msg_dump_walk(INFO, msg);
-	fd_log_debug("[dbg_rt] Current list of candidates (%p)\n", msg);
+	fd_log_debug("[dbg_rt] Current list of candidates (%p): (score - id)\n", msg);
 	
 	for (li = candidates->next; li != candidates; li = li->next) {
 		struct rtd_candidate *c = (struct rtd_candidate *) li;
-		fd_log_debug("[dbg_rt]   - %d\t%s\n", c->score, c->diamid);
+		fd_log_debug("[dbg_rt]   %d -\t%s\n", c->score, c->diamid);
 	}
 	
 	return 0;
--- a/libfreeDiameter/rt_data.c	Wed Jan 27 10:56:54 2010 +0900
+++ b/libfreeDiameter/rt_data.c	Thu Jan 28 15:01:50 2010 +0900
@@ -225,22 +225,21 @@
 	return 0;
 }
 
-/* Extract the list of valid candidates, and initialize their scores to 0 */
+/* Extract the list of valid candidates, and initialize their scores */
 void fd_rtd_candidate_extract(struct rt_data * rtd, struct fd_list ** candidates, int ini_score)
 {
+	struct fd_list * li;
+	
 	TRACE_ENTRY("%p %p", rtd, candidates);
 	CHECK_PARAMS_DO( candidates, return );
 	CHECK_PARAMS_DO( rtd, { *candidates = NULL; return; } );
 	
 	*candidates = &rtd->candidates;
 	
-	if (rtd->extracted) {
-		/* Reset all scores to INITIAL score */
-		struct fd_list * li;
-		for (li = rtd->candidates.next; li != &rtd->candidates; li = li->next) {
-			struct rtd_candidate * c = (struct rtd_candidate *) li;
-			c->score = ini_score;
-		}
+	/* Reset all scores to INITIAL score */
+	for (li = rtd->candidates.next; li != &rtd->candidates; li = li->next) {
+		struct rtd_candidate * c = (struct rtd_candidate *) li;
+		c->score = ini_score;
 	}
 	
 	rtd->extracted = 1;
"Welcome to our mercurial repository"