]> git.sur5r.net Git - openldap/commitdiff
destroy cache on exit
authorPierangelo Masarati <ando@openldap.org>
Wed, 20 Jul 2005 14:59:56 +0000 (14:59 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 20 Jul 2005 14:59:56 +0000 (14:59 +0000)
servers/slapd/back-monitor/cache.c
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/proto-back-monitor.h

index 086a8337132f1e61de5c51b195d7f7450be8deed..4f5ca062a2318f35b39452dbcbaca4a2ed9fc176 100644 (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;
+}
+
index e3cac86c0017d5279b8b7dcf4048bee0aacbf010..0213b9349e0db3fbb0541558be1e0bbf96a5ea87 100644 (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;
 }
 
index d73bf61d6b4de46249e60bdcf53ddaf32056f971..6de478a1cc26f1113daa1de372f935d6ee619b44 100644 (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
  */