changeset 453:9a8b3178a7a7

Postpone the creation of session expiry thread to allow some global variables to be set (debug level, etc)
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 29 Jul 2010 15:32:08 +0900
parents 2b36eccbe426
children f1484823cb4a
files freeDiameter/main.c include/freeDiameter/libfreeDiameter.h libfreeDiameter/sessions.c
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/freeDiameter/main.c	Thu Jul 29 14:48:19 2010 +0900
+++ b/freeDiameter/main.c	Thu Jul 29 15:32:08 2010 +0900
@@ -94,6 +94,7 @@
 	/* Initialize other modules */
 	CHECK_FCT(  fd_queues_init()  );
 	CHECK_FCT(  fd_msg_init()  );
+	CHECK_FCT(  fd_sess_start()  );
 	CHECK_FCT(  fd_p_expi_init()  );
 	
 	/* Parse the configuration file */
--- a/include/freeDiameter/libfreeDiameter.h	Thu Jul 29 14:48:19 2010 +0900
+++ b/include/freeDiameter/libfreeDiameter.h	Thu Jul 29 15:32:08 2010 +0900
@@ -1509,6 +1509,9 @@
 /* The state information that a module associate with a session -- each module defines its own data format */
 typedef void session_state;
 
+/* The following function must be called to activate the session expiry mechanism */
+int fd_sess_start(void);
+
 /*
  * FUNCTION:	fd_sess_handler_create
  *
--- a/libfreeDiameter/sessions.c	Thu Jul 29 14:48:19 2010 +0900
+++ b/libfreeDiameter/sessions.c	Thu Jul 29 15:32:08 2010 +0900
@@ -231,6 +231,12 @@
 		CHECK_POSIX(  pthread_mutex_init(&sess_hash[i].lock, NULL)  );
 	}
 	
+	return 0;
+}
+
+/* Run this when initializations are complete. */
+int fd_sess_start(void)
+{
 	/* Start session garbage collector (expiry) */
 	CHECK_POSIX(  pthread_create(&exp_thr, NULL, exp_fct, NULL)  );
 	
"Welcome to our mercurial repository"