# HG changeset patch # User Sebastien Decugis # Date 1280385128 -32400 # Node ID 9a8b3178a7a702c037eb3406063c47f50cd7c571 # Parent 2b36eccbe4261c2a4b481a9a07e281e3bd08f111 Postpone the creation of session expiry thread to allow some global variables to be set (debug level, etc) diff -r 2b36eccbe426 -r 9a8b3178a7a7 freeDiameter/main.c --- 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 */ diff -r 2b36eccbe426 -r 9a8b3178a7a7 include/freeDiameter/libfreeDiameter.h --- 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 * diff -r 2b36eccbe426 -r 9a8b3178a7a7 libfreeDiameter/sessions.c --- 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) );