mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
destroy exactly what needs to
This commit is contained in:
parent
6fd9090a0d
commit
4add034d5d
@ -384,16 +384,18 @@ int backend_shutdown( Backend *be )
|
||||
return 0;
|
||||
}
|
||||
|
||||
void backend_destroy_one( BackendDB *bd, int dynamic )
|
||||
/*
|
||||
* This function is supposed to be the exact counterpart
|
||||
* of backend_startup_one(), although this one calls bi_db_destroy()
|
||||
* while backend_startup_one() calls bi_db_open().
|
||||
*
|
||||
* Make sure backend_stopdown_one() destroys resources allocated
|
||||
* by backend_startup_one(); only call backend_destroy_one() when
|
||||
* all stuff in a BackendDB needs to be destroyed
|
||||
*/
|
||||
void
|
||||
backend_stopdown_one( BackendDB *bd )
|
||||
{
|
||||
if ( dynamic ) {
|
||||
LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
|
||||
}
|
||||
|
||||
if ( bd->be_syncinfo ) {
|
||||
syncinfo_free( bd->be_syncinfo );
|
||||
}
|
||||
|
||||
if ( bd->be_pending_csn_list ) {
|
||||
struct slap_csn_entry *csne;
|
||||
csne = LDAP_TAILQ_FIRST( bd->be_pending_csn_list );
|
||||
@ -411,6 +413,20 @@ void backend_destroy_one( BackendDB *bd, int dynamic )
|
||||
if ( bd->bd_info->bi_db_destroy ) {
|
||||
bd->bd_info->bi_db_destroy( bd );
|
||||
}
|
||||
}
|
||||
|
||||
void backend_destroy_one( BackendDB *bd, int dynamic )
|
||||
{
|
||||
if ( dynamic ) {
|
||||
LDAP_STAILQ_REMOVE(&backendDB, bd, slap_backend_db, be_next );
|
||||
}
|
||||
|
||||
if ( bd->be_syncinfo ) {
|
||||
syncinfo_free( bd->be_syncinfo );
|
||||
}
|
||||
|
||||
backend_stopdown_one( bd );
|
||||
|
||||
ber_bvarray_free( bd->be_suffix );
|
||||
ber_bvarray_free( bd->be_nsuffix );
|
||||
if ( !BER_BVISNULL( &bd->be_rootdn ) ) {
|
||||
|
@ -2301,16 +2301,8 @@ pcache_db_destroy(
|
||||
cache_manager *cm = on->on_bi.bi_private;
|
||||
query_manager *qm = cm->qm;
|
||||
|
||||
/* cleanup stuff inherited from the original database... */
|
||||
cm->db.be_suffix = NULL;
|
||||
cm->db.be_nsuffix = NULL;
|
||||
BER_BVZERO( &cm->db.be_rootdn );
|
||||
BER_BVZERO( &cm->db.be_rootndn );
|
||||
BER_BVZERO( &cm->db.be_rootpw );
|
||||
/* FIXME: there might be more... */
|
||||
|
||||
if ( cm->db.be_private != NULL ) {
|
||||
backend_destroy_one( &cm->db, 0 );
|
||||
backend_stopdown_one( &cm->db );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_destroy( &qm->lru_mutex );
|
||||
|
@ -773,16 +773,8 @@ translucent_db_destroy( BackendDB *be )
|
||||
Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
|
||||
|
||||
if ( ov ) {
|
||||
/* cleanup stuff inherited from the original database... */
|
||||
ov->db.be_suffix = NULL;
|
||||
ov->db.be_nsuffix = NULL;
|
||||
BER_BVZERO( &ov->db.be_rootdn );
|
||||
BER_BVZERO( &ov->db.be_rootndn );
|
||||
BER_BVZERO( &ov->db.be_rootpw );
|
||||
/* FIXME: there might be more... */
|
||||
|
||||
if ( ov->db.be_private != NULL ) {
|
||||
backend_destroy_one( &ov->db, 0 );
|
||||
backend_stopdown_one( &ov->db );
|
||||
}
|
||||
|
||||
ch_free(ov);
|
||||
|
@ -316,6 +316,7 @@ LDAP_SLAPD_F (int) backend_startup_one LDAP_P((Backend *be));
|
||||
LDAP_SLAPD_F (int) backend_sync LDAP_P((Backend *be));
|
||||
LDAP_SLAPD_F (int) backend_shutdown LDAP_P((Backend *be));
|
||||
LDAP_SLAPD_F (int) backend_destroy LDAP_P((void));
|
||||
LDAP_SLAPD_F (void) backend_stopdown_one LDAP_P((BackendDB *bd ));
|
||||
LDAP_SLAPD_F (void) backend_destroy_one LDAP_P((BackendDB *bd, int dynamic));
|
||||
|
||||
LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));
|
||||
|
Loading…
Reference in New Issue
Block a user