mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
cleanup
This commit is contained in:
parent
8b54d3b7e1
commit
47d39181d6
@ -57,8 +57,7 @@ monitor_subsys_backend_init(
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) )
|
||||
{
|
||||
if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"monitor_subsys_backend_init: "
|
||||
"unable to get entry \"%s\"\n",
|
||||
@ -73,7 +72,7 @@ monitor_subsys_backend_init(
|
||||
i = -1;
|
||||
LDAP_STAILQ_FOREACH( bi, &backendInfo, bi_next ) {
|
||||
char buf[ BACKMONITOR_BUFSIZE ];
|
||||
BackendDB *be;
|
||||
BackendDB *be;
|
||||
struct berval bv;
|
||||
int j;
|
||||
Entry *e;
|
||||
|
@ -136,6 +136,8 @@ monitor_cache_get(
|
||||
assert( ndn != NULL );
|
||||
assert( ep != NULL );
|
||||
|
||||
*ep = NULL;
|
||||
|
||||
tmp_mc.mc_ndn = *ndn;
|
||||
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
|
||||
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
|
||||
@ -144,16 +146,12 @@ monitor_cache_get(
|
||||
if ( mc != NULL ) {
|
||||
/* entry is returned with mutex locked */
|
||||
monitor_cache_lock( mc->mc_e );
|
||||
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
|
||||
*ep = mc->mc_e;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
|
||||
*ep = NULL;
|
||||
|
||||
return( -1 );
|
||||
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
|
||||
|
||||
return ( *ep == NULL ? -1 : 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1366,7 +1366,6 @@ int
|
||||
monitor_back_db_init(
|
||||
BackendDB *be )
|
||||
{
|
||||
monitor_info_t *mi;
|
||||
int rc;
|
||||
struct berval dn, ndn;
|
||||
struct berval bv;
|
||||
@ -1390,8 +1389,8 @@ monitor_back_db_init(
|
||||
rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unable to normalize monitor DN \"%s\"\n",
|
||||
SLAPD_MONITOR_DN, 0, 0 );
|
||||
"unable to normalize monitor DN \"%s\" (%d)\n",
|
||||
dn.bv_val, rc, 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1401,11 +1400,9 @@ monitor_back_db_init(
|
||||
|
||||
/* NOTE: only one monitor database is allowed,
|
||||
* so we use static storage */
|
||||
mi = &monitor_info;
|
||||
ldap_pvt_thread_mutex_init( &monitor_info.mi_cache_mutex );
|
||||
|
||||
ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
|
||||
|
||||
be->be_private = mi;
|
||||
be->be_private = &monitor_info;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user