changeset 74:9dcb1bd11a07

Some cleanups
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 01 Dec 2009 14:14:34 +0900
parents 02db4d794ccf
children e6bf3e262e49
files README freeDiameter/cnxctx.c freeDiameter/p_dw.c freeDiameter/p_psm.c freeDiameter/p_sr.c freeDiameter/server.c
diffstat 6 files changed, 31 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue Dec 01 11:35:15 2009 +0900
+++ b/README	Tue Dec 01 14:14:34 2009 +0900
@@ -10,3 +10,8 @@
 See LICENSE file for legal information on this software.
 
 See INSTALL for information on building and using this software.
+
+--------------
+Known possible bugs:
+ - management of the Host-IP-Address values in CER/CEA may be strange (for TCP and SCTP)
+ 
--- a/freeDiameter/cnxctx.c	Tue Dec 01 11:35:15 2009 +0900
+++ b/freeDiameter/cnxctx.c	Tue Dec 01 14:14:34 2009 +0900
@@ -703,7 +703,7 @@
 	/* Set the thread name */
 	{
 		char buf[48];
-		snprintf(buf, sizeof(buf), "Receiver (%d) TLS/ single stream)", conn->cc_socket);
+		snprintf(buf, sizeof(buf), "Receiver (%d) TLS/single stream", conn->cc_socket);
 		fd_log_threadname ( buf );
 	}
 	
--- a/freeDiameter/p_dw.c	Tue Dec 01 11:35:15 2009 +0900
+++ b/freeDiameter/p_dw.c	Tue Dec 01 14:14:34 2009 +0900
@@ -140,6 +140,8 @@
 /* Handle a timeout in the PSM (OPEN or REOPEN state only) */
 int fd_p_dw_timeout(struct fd_peer * peer)
 {
+	TRACE_ENTRY("%p", peer);
+
 	if (peer->p_flags.pf_dw_pending) {
 		/* We have sent a DWR and received no answer during TwTimer */
 		CHECK_FCT( fd_psm_change_state(peer, STATE_SUSPECT) );
@@ -150,14 +152,16 @@
 		fd_psm_next_timeout(peer, 0, peer->p_hdr.info.config.pic_twtimer ?: fd_g_config->cnf_timer_tw );
 	}
 	
-	
 	return 0;
 }
 
 /* Handle DW exchanges after the peer has come alive again */
 int fd_p_dw_reopen(struct fd_peer * peer)
 {
+	TRACE_ENTRY("%p", peer);
+
 	peer->p_flags.pf_reopen_cnt = 1;
+	peer->p_flags.pf_cnx_pb = 0;
 	CHECK_FCT( send_DWR(peer) );
 	
 	return 0;
--- a/freeDiameter/p_psm.c	Tue Dec 01 11:35:15 2009 +0900
+++ b/freeDiameter/p_psm.c	Tue Dec 01 14:14:34 2009 +0900
@@ -235,6 +235,8 @@
 	
 	peer->p_psm_timer.tv_sec += delay;
 	
+	TRACE_DEBUG(FULL, "Peer timeout reset to %d seconds%s", delay, add_random ? " (+/- 2)", "" );
+	
 #ifdef SLOW_PSM
 	/* temporary for debug */
 	peer->p_psm_timer.tv_sec += 10;
@@ -245,7 +247,9 @@
 void fd_psm_cleanup(struct fd_peer * peer, int terminate)
 {
 	/* Move to CLOSED state: failover messages, stop OUT thread, unlink peer from active list */
-	CHECK_FCT_DO( fd_psm_change_state(peer, STATE_CLOSED), /* continue */ );
+	if (peer->p_hdr.info.runtime.pir_state != STATE_ZOMBIE) {
+		CHECK_FCT_DO( fd_psm_change_state(peer, STATE_CLOSED), /* continue */ );
+	}
 	
 	fd_p_cnx_abort(peer, terminate);
 	
@@ -513,8 +517,11 @@
 	if (event == FDEVP_CNX_ERROR) {
 		switch (peer->p_hdr.info.runtime.pir_state) {
 			case STATE_WAITCNXACK_ELEC:
-				TODO("Reply CEA on the receiver side and go to OPEN state");
-				goto psm_loop;
+				/* Abort the initiating side */
+				fd_p_cnx_abort(peer, 0);
+				/* Process the receiver side */
+				CHECK_FCT_DO( fd_p_ce_process_receiver(peer), goto psm_end );
+				break;
 			
 			case STATE_OPEN:
 			case STATE_REOPEN:
@@ -533,9 +540,10 @@
 				fd_psm_next_timeout(peer, 1, peer->p_hdr.info.config.pic_tctimer ?: fd_g_config->cnf_timer_tc);
 				
 			case STATE_CLOSED:
-				/* Go to the next event */
-				goto psm_loop;
+				/* Just ignore */
+				;
 		}
+		goto psm_loop;
 	}
 	
 	/* The connection notified a change in endpoints */
--- a/freeDiameter/p_sr.c	Tue Dec 01 11:35:15 2009 +0900
+++ b/freeDiameter/p_sr.c	Tue Dec 01 14:14:34 2009 +0900
@@ -35,6 +35,10 @@
 
 #include "fD.h"
 
+#ifndef SR_DEBUG_LVL
+#define SR_DEBUG_LVL ANNOYING
+#endif /* SR_DEBUG_LVL */
+
 /* Structure to store a sent request */
 struct sentreq {
 	struct fd_list	chain; 	/* the "o" field points directly to the hop-by-hop of the request (uint32_t *)  */
@@ -60,14 +64,14 @@
 static void srl_dump(const char * text, struct fd_list * srlist)
 {
 	struct fd_list * li;
-	if (!TRACE_BOOL(FULL))
+	if (!TRACE_BOOL(SR_DEBUG_LVL))
 		return;
 	fd_log_debug("%sSentReq list @%p:\n", text, srlist);
 	for (li = srlist->next; li != srlist; li = li->next) {
 		struct sentreq * sr = (struct sentreq *)li;
 		uint32_t * nexthbh = li->o;
 		fd_log_debug(" - Next req (%x):\n", *nexthbh);
-		fd_msg_dump_one(FULL + 1, sr->req);
+		fd_msg_dump_one(SR_DEBUG_LVL + 1, sr->req);
 	}
 }
 
--- a/freeDiameter/server.c	Tue Dec 01 11:35:15 2009 +0900
+++ b/freeDiameter/server.c	Tue Dec 01 14:14:34 2009 +0900
@@ -141,10 +141,7 @@
 	/* We expect a CER, it must parse with our dictionary and rules */
 	CHECK_FCT_DO( fd_msg_parse_rules( msg, fd_g_config->cnf_dict, NULL ), /* Parsing failed -- trace details ? */ goto cleanup );
 	
-	if (TRACE_BOOL(FULL)) {
-		fd_log_debug("Received Diameter message from new client '%s':\n", fd_cnx_getid(c->conn));
-		fd_msg_dump_walk(FULL, msg);
-	}
+	fd_msg_dump_walk(FULL, msg);
 	
 	/* Now check we received a CER */
 	CHECK_FCT_DO( fd_msg_hdr ( msg, &hdr ), goto fatal_error );
"Welcome to our mercurial repository"