diff libfdcore/p_expiry.c @ 706:4ffbc9f1e922

Large UNTESTED commit with the following changes: * Improved DiameterIdentity handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7) * Cleanup in the session module to free only unreferenced sessions (#16) * Removed fd_cpu_flush_cache(), replaced by more robust alternatives. * Improved peer state machine algorithm to counter SCTP multistream race condition.
author Sebastien Decugis <sdecugis@nict.go.jp>
date Wed, 09 Feb 2011 15:26:58 +0900
parents 78b665400097
children 4a9f08d6b6ba
line wrap: on
line diff
--- a/libfdcore/p_expiry.c	Mon Jan 31 17:22:21 2011 +0900
+++ b/libfdcore/p_expiry.c	Wed Feb 09 15:26:58 2011 +0900
@@ -58,10 +58,9 @@
 		CHECK_FCT_DO( pthread_rwlock_wrlock(&fd_g_peers_rw), goto error );
 		
 		for (li = fd_g_peers.next; li != &fd_g_peers; li = li->next) {
-			struct fd_peer * peer = (struct fd_peer *)li;
+			struct fd_peer * peer = (struct fd_peer *)li->o;
 			
-			fd_cpu_flush_cache();
-			if (peer->p_hdr.info.runtime.pir_state != STATE_ZOMBIE)
+			if (fd_peer_getstate(peer) != STATE_ZOMBIE)
 				continue;
 			
 			if (peer->p_hdr.info.config.pic_flags.persist == PI_PRST_ALWAYS)
@@ -77,7 +76,7 @@
 		
 		/* Now delete peers that are in the purge list */
 		while (!FD_IS_LIST_EMPTY(&purge)) {
-			struct fd_peer * peer = (struct fd_peer *)(purge.next);
+			struct fd_peer * peer = (struct fd_peer *)(purge.next->o);
 			fd_list_unlink(&peer->p_hdr.chain);
 			TRACE_DEBUG(INFO, "Garbage Collect: delete zombie peer '%s'", peer->p_hdr.info.pi_diamid);
 			CHECK_FCT_DO( fd_peer_free(&peer), /* Continue... what else to do ? */ );
@@ -104,7 +103,7 @@
 		struct timespec	now;
 		struct fd_peer * first;
 		
-		/* Check if there are expiring sessions available */
+		/* Check if there are expiring peers available */
 		if (FD_IS_LIST_EMPTY(&exp_list)) {
 			/* Just wait for a change or cancelation */
 			CHECK_POSIX_DO( pthread_cond_wait( &exp_cnd, &exp_mtx ), { ASSERT(0); } );
@@ -182,7 +181,7 @@
 		struct fd_list * li;
 		
 		/* update the p_exp_timer value */
-		CHECK_SYS(  clock_gettime(CLOCK_REALTIME, &peer->p_exp_timer)  );
+		CHECK_SYS_DO(  clock_gettime(CLOCK_REALTIME, &peer->p_exp_timer), { ASSERT(0); }  );
 		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) */
"Welcome to our mercurial repository"