destroy cache on exit

This commit is contained in:
Pierangelo Masarati 2005-07-20 14:59:56 +00:00
parent 628da7be89
commit 3df83d7089
3 changed files with 49 additions and 0 deletions

View file

@ -267,3 +267,40 @@ monitor_cache_release(
return( 0 );
}
static void
monitor_entry_destroy( void *v_mc )
{
monitor_cache_t *mc = (monitor_cache_t *)v_mc;
if ( mc->mc_e != NULL ) {
monitor_entry_t *mp;
assert( mc->mc_e->e_private != NULL );
mp = ( monitor_entry_t * )mc->mc_e->e_private;
if ( mp->mp_cb ) {
/* TODO */
}
ldap_pvt_thread_mutex_destroy( &mp->mp_mutex );
ch_free( mp );
mc->mc_e->e_private = NULL;
entry_free( mc->mc_e );
}
ch_free( mc );
}
int
monitor_cache_destroy(
monitor_info_t *mi )
{
if ( mi->mi_cache ) {
avl_free( mi->mi_cache, monitor_entry_destroy );
}
return 0;
}

View file

@ -1706,7 +1706,9 @@ monitor_back_db_config(
int argc,
char **argv )
{
#if 0
monitor_info_t *mi = ( monitor_info_t * )be->be_private;
#endif
/*
* eventually, will hold database specific configuration parameters
@ -1725,6 +1727,12 @@ monitor_back_db_destroy(
*/
/* NOTE: mi points to static storage; don't free it */
(void)monitor_cache_destroy( mi );
if ( monitor_subsys ) {
ch_free( monitor_subsys );
}
return 0;
}

View file

@ -68,6 +68,10 @@ monitor_cache_release LDAP_P((
monitor_info_t *mi,
Entry *e ));
extern int
monitor_cache_destroy LDAP_P((
monitor_info_t *mi ));
/*
* connections
*/