mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-04-06 15:00:40 +08:00
Round 2 of connection management changes.
Mainly updated back-bdb2, back-passwd, back-shell to use slap_get_time().
This commit is contained in:
parent
8f02beada9
commit
c9eacbdc64
@ -154,10 +154,7 @@ bdb2i_back_search_internal(
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
|
||||
|
||||
/* check time limit */
|
||||
ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
|
||||
time( ¤ttime );
|
||||
if ( tlimit != -1 && currenttime > stoptime ) {
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
if ( tlimit != -1 && slap_get_time() > stoptime ) {
|
||||
send_ldap_search_result( conn, op,
|
||||
LDAP_TIMELIMIT_EXCEEDED, NULL, nrefs > 0 ? rbuf :
|
||||
NULL, nentries );
|
||||
@ -168,7 +165,6 @@ bdb2i_back_search_internal(
|
||||
}
|
||||
return( 0 );
|
||||
}
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
|
||||
/* get the entry with reader lock */
|
||||
if ( (e = bdb2i_id2entry_r( be, id )) == NULL ) {
|
||||
|
@ -764,10 +764,8 @@ bdb2i_set_txn_checkpoint( DB_TXNMGR *txmgr, int forced )
|
||||
logsize = forced ? (u_int32_t) 0 : txn_max_pending_log;
|
||||
mins = forced ? (u_int32_t) 0 : txn_max_pending_time;
|
||||
|
||||
ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
|
||||
time( ¤ttime );
|
||||
now = currenttime;
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
slap_set_time();
|
||||
now = slap_get_time();
|
||||
|
||||
rc = txn_checkpoint( txmgr, logsize, mins );
|
||||
|
||||
|
@ -82,16 +82,12 @@ passwd_back_search(
|
||||
ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
|
||||
|
||||
/* check time limit */
|
||||
ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
|
||||
time( ¤ttime );
|
||||
if ( currenttime > stoptime ) {
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
if ( slap_get_time() > stoptime ) {
|
||||
send_ldap_result( conn, op, LDAP_TIMELIMIT_EXCEEDED,
|
||||
NULL, NULL );
|
||||
endpwent();
|
||||
return( 0 );
|
||||
}
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
|
||||
e = pw2entry( be, pw );
|
||||
|
||||
|
@ -26,7 +26,7 @@ shell_back_abandon(
|
||||
|
||||
/* no abandon command defined - just kill the process handling it */
|
||||
if ( si->si_abandon == NULL ) {
|
||||
ldap_pvt_thread_mutex_lock( &conn->c_opsmutex );
|
||||
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
|
||||
pid = -1;
|
||||
for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
|
||||
if ( o->o_msgid == msgid ) {
|
||||
@ -34,7 +34,15 @@ shell_back_abandon(
|
||||
break;
|
||||
}
|
||||
}
|
||||
ldap_pvt_thread_mutex_unlock( &conn->c_opsmutex );
|
||||
if( pid == -1 ) {
|
||||
for ( o = conn->c_pending_ops; o != NULL; o = o->o_next ) {
|
||||
if ( o->o_msgid == msgid ) {
|
||||
pid = (pid_t) o->o_private;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
|
||||
|
||||
if ( pid != -1 ) {
|
||||
Debug( LDAP_DEBUG_ARGS, "shell killing pid %d\n", pid,
|
||||
|
@ -306,8 +306,6 @@ slapd_daemon_task(
|
||||
/* FALL THRU */
|
||||
}
|
||||
|
||||
slap_set_time();
|
||||
|
||||
if ( FD_ISSET( tcps, &readfds ) ) {
|
||||
int s;
|
||||
int len = sizeof(from);
|
||||
|
@ -57,7 +57,6 @@ ldap_pvt_thread_mutex_t replog_mutex;
|
||||
static char* slap_name;
|
||||
int slapMode = SLAP_UNDEFINED_MODE;
|
||||
|
||||
static time_t currenttime;
|
||||
static ldap_pvt_thread_mutex_t currenttime_mutex;
|
||||
|
||||
int
|
||||
@ -160,19 +159,11 @@ int slap_destroy(void)
|
||||
}
|
||||
|
||||
/* should create a utils.c for these */
|
||||
|
||||
void slap_set_time(void)
|
||||
{
|
||||
ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
|
||||
time( ¤ttime );
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
}
|
||||
|
||||
time_t slap_get_time(void)
|
||||
{
|
||||
time_t t;
|
||||
ldap_pvt_thread_mutex_lock( ¤ttime_mutex );
|
||||
t = currenttime;
|
||||
time( &t );
|
||||
ldap_pvt_thread_mutex_unlock( ¤ttime_mutex );
|
||||
return t;
|
||||
}
|
||||
|
@ -287,7 +287,6 @@ extern char **g_argv;
|
||||
extern time_t starttime;
|
||||
|
||||
time_t slap_get_time LDAP_P((void));
|
||||
void slap_set_time LDAP_P((void));
|
||||
|
||||
extern ldap_pvt_thread_mutex_t active_threads_mutex;
|
||||
extern ldap_pvt_thread_cond_t active_threads_cond;
|
||||
|
@ -8,6 +8,16 @@
|
||||
|
||||
#include "../slap.h"
|
||||
|
||||
/* bogus ../results.c */
|
||||
int str2result(
|
||||
char* s,
|
||||
int *code,
|
||||
char **matched,
|
||||
char **info )
|
||||
{
|
||||
assert(0);
|
||||
}
|
||||
|
||||
void
|
||||
send_ldap_result(
|
||||
Connection *conn,
|
||||
|
@ -7,8 +7,8 @@ SUBDIRS= progs
|
||||
BUILD_BDB2 = @BUILD_BDB2@
|
||||
|
||||
test-bdb2: FORCE
|
||||
@-$(LN_S) $(srcdir)/data .
|
||||
@if test "$(BUILD_BDB2)" = "yes" ; then \
|
||||
$(LN_S) $(srcdir)/data . ; \
|
||||
echo "Initiating LDAP tests..." ; \
|
||||
$(MKDIR) test-db test-repl ; \
|
||||
$(srcdir)/scripts/all $(srcdir) bdb2 ; \
|
||||
|
Loading…
x
Reference in New Issue
Block a user