Index: include/freeDiameter/libfdcore.h
===================================================================
--- include/freeDiameter/libfdcore.h	(revision 947)
+++ include/freeDiameter/libfdcore.h	(revision 968)
@@ -385,4 +385,21 @@
 int fd_peer_get_state(struct peer_hdr *peer);
 
+/* 
+ * FUNCTION:	fd_peer_get_load_pending
+ *
+ * PARAMETERS:
+ *  peer	: The peer which load to read
+ *
+ * DESCRIPTION: 
+ *   Returns the current number of requests sent to this peer
+ *  that have not been answered yet. This is an empirical indication
+ *  of the workload of this peer.
+ *
+ * RETURN VALUE:
+ *  0  : The load parameter has been updated. (it should have a positive value always)
+ * !0  : An error occurred
+ */
+int fd_peer_get_load_pending(struct peer_hdr *peer, int * load);
+
 /*
  * FUNCTION:	fd_peer_validate_register
Index: libfdcore/fdcore-internal.h
===================================================================
--- libfdcore/fdcore-internal.h	(revision 928)
+++ libfdcore/fdcore-internal.h	(revision 938)
@@ -126,4 +126,5 @@
 	struct fd_list 	srs; /* requests ordered by hop-by-hop id */
 	struct fd_list  exp; /* requests that have a timeout set, ordered by timeout */
+	int             cnt; /* number of requests in the srs list */
 	pthread_mutex_t	mtx; /* mutex to protect these lists */
 	pthread_cond_t  cnd; /* cond var used by the thread that handles timeouts */
Index: libfdcore/fdd.l
===================================================================
--- libfdcore/fdd.l	(revision 965)
+++ libfdcore/fdd.l	(revision 969)
@@ -52,5 +52,5 @@
 	yylloc->first_column = yylloc->last_column + 1; 		\
 	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
-	TRACE_ERROR( 						\
+	fd_log_debug(	 						\
 		"(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n",	\
 		yylloc->first_line, yylloc->first_column, 		\
Index: libfdcore/fdd.y
===================================================================
--- libfdcore/fdd.y	(revision 965)
+++ libfdcore/fdd.y	(revision 969)
@@ -323,13 +323,16 @@
 						{ yyerror (&yylloc, conf, "Not enough memory"); YYERROR; } );
 					sprintf(fname, DEFAULT_EXTENSIONS_PATH "/%s", bkp);
-					free(bkp);
 					fd = fopen(fname, "r");
-				}
-				if (fd == NULL) {
-					int ret = errno;
-					TRACE_ERROR("WARNING: Unable to open extension file %s for reading: %s\nLD_LIBRARY_PATH will be used.\n", fname, strerror(ret));
-				} else {
+					if (fd == NULL) {
+						free(fname);
+						fname = bkp;
+					} else {
+						free(bkp);
+					}
+				}
+				if (fd != NULL) {
 					fclose(fd);
-				}
+				} /* otherwise, LD_LIBRARY_PATH will be tested by dl_open. 
+				This should not give any security issue, otherwise we can add an "else fail" here. */
 				
 				/* Try and open the configuration file (optional) */
Index: libfdcore/p_sr.c
===================================================================
--- libfdcore/p_sr.c	(revision 837)
+++ libfdcore/p_sr.c	(revision 938)
@@ -226,4 +226,5 @@
 	*req = NULL;
 	fd_list_insert_before(next, &sr->chain);
+	srlist->cnt++;
 	srl_dump("Saved new request, ", &srlist->srs);
 	
@@ -281,4 +282,5 @@
 		/* Unlink */
 		fd_list_unlink(&sr->chain);
+		srlist->cnt--;
 		fd_list_unlink(&sr->expire);
 		*req = sr->req;
@@ -300,4 +302,5 @@
 		struct sentreq * sr = (struct sentreq *)(srlist->srs.next);
 		fd_list_unlink(&sr->chain);
+		srlist->cnt--;
 		fd_list_unlink(&sr->expire);
 		if (fd_msg_is_routable(sr->req)) {
Index: libfdcore/peers.c
===================================================================
--- libfdcore/peers.c	(revision 961)
+++ libfdcore/peers.c	(revision 968)
@@ -257,4 +257,19 @@
 }
 
+/* Return the value of srlist->cnt */
+int fd_peer_get_load_pending(struct peer_hdr *peer, int * load)
+{
+	struct fd_peer * p = (struct fd_peer *)peer;
+	TRACE_ENTRY("%p %p", peer, load);
+	CHECK_PARAMS(CHECK_PEER(peer) && load);
+	
+	CHECK_POSIX( pthread_mutex_lock(&p->p_sr.mtx) );
+	*load = p->p_sr.cnt;
+	CHECK_POSIX( pthread_mutex_unlock(&p->p_sr.mtx) );
+	
+	return 0;
+}
+
+
 /* Destroy a structure once cleanups have been performed (fd_psm_abord, ...) */
 int fd_peer_free(struct fd_peer ** ptr)
@@ -395,5 +410,5 @@
 	}
 
-	fd_log_debug(">  %s\t%s", STATE_STR(fd_peer_getstate(peer)), peer->p_hdr.info.pi_diamid);
+	fd_log_debug(">  %s\t%s\t[%dsr]", STATE_STR(fd_peer_getstate(peer)), peer->p_hdr.info.pi_diamid, peer->p_sr.cnt);
 	if (details > INFO) {
 		fd_log_debug("\t(rlm:%s)", peer->p_hdr.info.runtime.pir_realm ?: "<unknown>");
