diff libfdcore/p_out.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_out.c	Mon Jan 31 17:22:21 2011 +0900
+++ b/libfdcore/p_out.c	Wed Feb 09 15:26:58 2011 +0900
@@ -108,7 +108,7 @@
 	/* Set the thread name */
 	{
 		char buf[48];
-		sprintf(buf, "OUT/%.*s", (int)sizeof(buf) - 5, peer->p_hdr.info.pi_diamid);
+		snprintf(buf, sizeof(buf), "OUT/%s", peer->p_hdr.info.pi_diamid);
 		fd_log_threadname ( buf );
 	}
 	
@@ -148,8 +148,7 @@
 	TRACE_ENTRY("%p %p %p %x", msg, cnx, peer, flags);
 	CHECK_PARAMS( msg && *msg && (cnx || (peer && peer->p_cnxctx)));
 	
-	fd_cpu_flush_cache();
-	if (peer && (peer->p_hdr.info.runtime.pir_state == STATE_OPEN)) {
+	if (fd_peer_getstate(peer) == STATE_OPEN) {
 		/* Normal case: just queue for the out thread to pick it up */
 		CHECK_FCT( fd_fifo_post(peer->p_tosend, msg) );
 		
"Welcome to our mercurial repository"