diff libfreeDiameter/messages.c @ 291:2d3a799ad29c

Cache the session pointer in answers when it was present in queries
author Sebastien Decugis <sdecugis@nict.go.jp>
date Mon, 10 May 2010 14:10:51 +0900
parents 3019f6220122
children e283e18b2673
line wrap: on
line diff
--- a/libfreeDiameter/messages.c	Fri May 07 16:33:12 2010 +0900
+++ b/libfreeDiameter/messages.c	Mon May 10 14:10:51 2010 +0900
@@ -335,6 +335,8 @@
 		val.os.len  = strlen(sid);
 		CHECK_FCT( fd_msg_avp_setvalue( avp, &val ) );
 		CHECK_FCT( fd_msg_avp_add( ans, MSG_BRW_FIRST_CHILD, avp ) );
+		ans->msg_sess = sess;
+		CHECK_FCT( fd_sess_ref_msg(sess) );
 	}
 	
 	/* associate with query */
@@ -2207,13 +2209,13 @@
 	/* So start browsing the message */
 	CHECK_FCT_DO( ret = fd_msg_browse( *msg, MSG_BRW_FIRST_CHILD, &avp, NULL ), goto error );
 	while (avp != NULL) {
-		/* Sanity */
-		ASSERT( avp->avp_public.avp_value );
-		
 		/* For unknown AVP, we don't have a callback registered, so just skip */
 		if (avp->avp_model) {
 			struct dict_object * type, * enumval;
 			
+			/* Sanity */
+			ASSERT( avp->avp_public.avp_value );
+
 			/* Get the list of callback for this AVP */
 			CHECK_FCT_DO( ret = fd_dict_disp_cb(DICT_AVP, avp->avp_model, &cb_list), goto error );
 			
"Welcome to our mercurial repository"