diff freeDiameter/p_expiry.c @ 37:cc3c59fe98fe

Lot of cleanups in peer structure management
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 05 Nov 2009 14:28:46 +0900
parents 1498b3c7304c
children a58f0757c06a
line wrap: on
line diff
--- a/freeDiameter/p_expiry.c	Mon Nov 02 17:31:36 2009 +0900
+++ b/freeDiameter/p_expiry.c	Thu Nov 05 14:28:46 2009 +0900
@@ -60,10 +60,10 @@
 		for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
 			struct fd_peer * peer = (struct fd_peer *)li;
 			
-			if (peer->p_hdr.info.pi_state != STATE_ZOMBIE)
+			if (peer->p_hdr.info.runtime.pir_state != STATE_ZOMBIE)
 				continue;
 			
-			if (peer->p_hdr.info.pi_flags.persist == PI_PRST_ALWAYS)
+			if (peer->p_hdr.info.config.pic_flags.persist == PI_PRST_ALWAYS)
 				continue; /* This peer was not supposed to terminate, keep it in the list for debug */
 			
 			/* Ok, the peer was expired, let's remove it */
@@ -157,13 +157,12 @@
 {
 	CHECK_FCT_DO( fd_thr_term(&exp_thr), );
 	CHECK_POSIX( pthread_mutex_lock(&exp_mtx) );
-	
 	while (!FD_IS_LIST_EMPTY(&exp_list)) {
 		struct fd_peer * peer = (struct fd_peer *)(exp_list.next->o);
 		fd_list_unlink(&peer->p_expiry );
 	}
+	CHECK_POSIX( pthread_mutex_unlock(&exp_mtx) );
 	
-	CHECK_POSIX( pthread_mutex_unlock(&exp_mtx) );
 	CHECK_FCT_DO( fd_thr_term(&gc_thr), );
 	return 0;
 }
@@ -179,12 +178,12 @@
 	fd_list_unlink(&peer->p_expiry );
 	
 	/* if peer expires */
-	if (peer->p_hdr.info.pi_flags.exp) {
+	if (peer->p_hdr.info.config.pic_flags.exp) {
 		struct fd_list * li;
 		
 		/* update the p_exp_timer value */
 		CHECK_SYS(  clock_gettime(CLOCK_REALTIME, &peer->p_exp_timer)  );
-		peer->p_exp_timer.tv_sec += peer->p_hdr.info.pi_lft;
+		peer->p_exp_timer.tv_sec += peer->p_hdr.info.config.pic_lft;
 		
 		/* add to the expiry list in appropriate position (probably around the end) */
 		for (li = exp_list.prev; li != &exp_list; li = li->prev) {
"Welcome to our mercurial repository"