changeset 233:87ca7b66a90c

Make the CEA broadcast optional
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 04 Mar 2010 17:24:31 +0900
parents c07f9692b537
children f91fe0b85928
files freeDiameter/p_ce.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/freeDiameter/p_ce.c	Thu Mar 04 17:24:14 2010 +0900
+++ b/freeDiameter/p_ce.c	Thu Mar 04 17:24:31 2010 +0900
@@ -37,6 +37,13 @@
 
 /* This file contains code to handle Capabilities Exchange messages (CER and CEA) and election process */
 
+/* Compilation option:
+ USE_CEA_BROADCAST
+ 	Define this to enable sending multiple copies of the CEA in case of SCTP connection.
+	This avoids a race condition when sending an application message over a different stream
+	than the CEA, it might be delivered first and thus ignored.
+*/
+
 /* Save a connection as peer's principal */
 static int set_peer_cnx(struct fd_peer * peer, struct cnxctx **cnx)
 {
@@ -812,7 +819,11 @@
 	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 ) );
 	CHECK_FCT( add_CE_info(msg, peer->p_cnxctx, isi & PI_SEC_TLS_OLD, isi & PI_SEC_NONE) );
+#ifdef USE_CEA_BROADCAST
 	CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, (isi & PI_SEC_TLS_OLD) ? FD_CNX_ORDERED : FD_CNX_BROADCAST) ); /* Broadcast in order to avoid further messages sent over a different stream be delivered first... */
+#else /* USE_CEA_BROADCAST */
+	CHECK_FCT( fd_out_send(&msg, peer->p_cnxctx, peer, FD_CNX_ORDERED ) );
+#endif /* USE_CEA_BROADCAST */
 	
 	/* Handshake if needed */
 	if (isi & PI_SEC_TLS_OLD) {
"Welcome to our mercurial repository"