diff libfdcore/p_ce.c @ 1238:8f9684264fe0

Change management of the p_reqin_count counter to be updated only on routable messages. This should limit the errors in the counter value resulting from rejected or discarded link-local messages.
author Sebastien Decugis <sdecugis@freediameter.net>
date Thu, 10 Oct 2013 16:08:46 +0200
parents e72c9dad62ac
children 4ad4d614acfa
line wrap: on
line diff
--- a/libfdcore/p_ce.c	Sat Sep 14 12:56:05 2013 +0200
+++ b/libfdcore/p_ce.c	Thu Oct 10 16:08:46 2013 +0200
@@ -634,7 +634,7 @@
 	/* Create and send the CEA with appropriate error code */
 	CHECK_FCT_DO( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, cer, MSGFL_ANSW_ERROR ), goto destroy );
 	CHECK_FCT_DO( fd_msg_rescode_set(*cer, error->pei_errcode, error->pei_message, error->pei_avp, 1 ), goto destroy );
-	CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL), goto destroy );
+	CHECK_FCT_DO( fd_out_send(cer, *recv_cnx, NULL, 0), goto destroy );
 	
 	if (error->pei_avp_free) {
 		fd_msg_free(error->pei_avp);
@@ -658,7 +658,7 @@
 	
 	/* Send CER on the new connection */
 	CHECK_FCT( create_CER(peer, initiator, &cer) );
-	CHECK_FCT( fd_out_send(&cer, initiator, peer) );
+	CHECK_FCT( fd_out_send(&cer, initiator, peer, 0) );
 	
 	/* Are we doing an election ? */
 	if (fd_peer_getstate(peer) == STATE_WAITCNXACK_ELEC) {
@@ -713,7 +713,7 @@
 		CHECK_FCT( fd_msg_rescode_set(*msg, "DIAMETER_UNABLE_TO_COMPLY", "No CER allowed in current state", NULL, 1 ) );
 
 		/* msg now contains an answer message to send back */
-		CHECK_FCT_DO( fd_out_send(msg, NULL, peer), /* In case of error the message has already been dumped */ );
+		CHECK_FCT_DO( fd_out_send(msg, NULL, peer, 0), /* In case of error the message has already been dumped */ );
 	}
 	
 	/* If the state is not WAITCEA, just discard the message */
@@ -942,11 +942,6 @@
 			isi = 0;
 	}
 	
-	/* Update the counter to match with the answer being sent */
-	CHECK_POSIX( pthread_mutex_lock(&peer->p_state_mtx) );
-	peer->p_reqin_count++;
-	CHECK_POSIX( pthread_mutex_unlock(&peer->p_state_mtx) );
-
 	/* Reply a CEA */
 	CHECK_FCT( fd_msg_new_answer_from_req ( fd_g_config->cnf_dict, &msg, 0 ) );
 	CHECK_FCT( fd_msg_rescode_set(msg, "DIAMETER_SUCCESS", NULL, NULL, 0 ) );
@@ -955,7 +950,7 @@
 	/* The connection is complete, but we may still need TLS handshake */
 	fd_hook_call(HOOK_PEER_CONNECT_SUCCESS, msg, peer, NULL, NULL);
 	
-	CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer ) );
+	CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, 0 ) );
 	
 	/* Handshake if needed */
 	if (isi & PI_SEC_TLS_OLD) {
"Welcome to our mercurial repository"