mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Add tool-threads config keyword, init thread pool in tool mode.
This commit is contained in:
parent
b3c3335418
commit
fc621a1c78
@ -163,6 +163,7 @@ enum {
|
||||
CFG_SASLSECP,
|
||||
CFG_SSTR_IF_MAX,
|
||||
CFG_SSTR_IF_MIN,
|
||||
CFG_TTHREADS,
|
||||
|
||||
CFG_LAST
|
||||
};
|
||||
@ -570,6 +571,9 @@ static ConfigTable config_back_cf_table[] = {
|
||||
#endif
|
||||
"( OLcfgGlAt:77 NAME 'olcTLSDHParamDir' "
|
||||
"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
|
||||
{ "tool-threads", "count", 2, 2, 0, ARG_INT|ARG_MAGIC|CFG_TTHREADS,
|
||||
&config_generic, "( OLcfgGlAt:80 NAME 'olcToolThreads' "
|
||||
"SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
|
||||
{ "ucdata-path", "path", 2, 2, 0, ARG_IGNORED,
|
||||
NULL, NULL, NULL, NULL },
|
||||
{ "updatedn", "dn", 2, 2, 0, ARG_DB|ARG_DN|ARG_QUOTE|ARG_MAGIC,
|
||||
@ -628,6 +632,7 @@ static ConfigOCs cf_ocs[] = {
|
||||
"olcTLSCACertificatePath $ olcTLSCertificateFile $ "
|
||||
"olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
|
||||
"olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamDir $ "
|
||||
"olcToolThreads $ "
|
||||
"olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
|
||||
"olcDitContentRules ) )", Cft_Global },
|
||||
{ "( OLcfgGlOc:2 "
|
||||
@ -700,6 +705,9 @@ config_generic(ConfigArgs *c) {
|
||||
case CFG_THREADS:
|
||||
c->value_int = connection_pool_max;
|
||||
break;
|
||||
case CFG_TTHREADS:
|
||||
c->value_int = slap_tool_thread_max;
|
||||
break;
|
||||
case CFG_SALT:
|
||||
if ( passwd_salt )
|
||||
c->value_string = ch_strdup( passwd_salt );
|
||||
@ -909,6 +917,7 @@ config_generic(ConfigArgs *c) {
|
||||
/* single-valued attrs, no-ops */
|
||||
case CFG_CONCUR:
|
||||
case CFG_THREADS:
|
||||
case CFG_TTHREADS:
|
||||
case CFG_RO:
|
||||
case CFG_AZPOLICY:
|
||||
case CFG_DEPTH:
|
||||
@ -1022,6 +1031,11 @@ config_generic(ConfigArgs *c) {
|
||||
connection_pool_max = c->value_int; /* save for reference */
|
||||
break;
|
||||
|
||||
case CFG_TTHREADS:
|
||||
ldap_pvt_thread_pool_maxthreads(&connection_pool, c->value_int);
|
||||
slap_tool_thread_max = c->value_int; /* save for reference */
|
||||
break;
|
||||
|
||||
case CFG_SALT:
|
||||
if ( passwd_salt ) ch_free( passwd_salt );
|
||||
passwd_salt = c->value_string;
|
||||
|
@ -67,6 +67,7 @@ struct berval NoAttrs = BER_BVC( LDAP_NO_ATTRS );
|
||||
*/
|
||||
ldap_pvt_thread_pool_t connection_pool;
|
||||
int connection_pool_max = SLAP_MAX_WORKER_THREADS;
|
||||
int slap_tool_thread_max = 1;
|
||||
#ifndef HAVE_GMTIME_R
|
||||
ldap_pvt_thread_mutex_t gmtime_mutex;
|
||||
#endif
|
||||
@ -124,8 +125,6 @@ slap_init( int mode, const char *name )
|
||||
|
||||
switch ( slapMode & SLAP_MODE ) {
|
||||
case SLAP_SERVER_MODE:
|
||||
ldap_pvt_thread_pool_init( &connection_pool,
|
||||
connection_pool_max, 0);
|
||||
|
||||
/* FALLTHRU */
|
||||
case SLAP_TOOL_MODE:
|
||||
@ -136,6 +135,9 @@ slap_init( int mode, const char *name )
|
||||
|
||||
slap_name = name;
|
||||
|
||||
ldap_pvt_thread_pool_init( &connection_pool,
|
||||
connection_pool_max, 0);
|
||||
|
||||
ldap_pvt_thread_mutex_init( &entry2str_mutex );
|
||||
ldap_pvt_thread_mutex_init( &replog_mutex );
|
||||
|
||||
|
@ -1734,6 +1734,7 @@ LDAP_SLAPD_V (time_t) starttime;
|
||||
|
||||
LDAP_SLAPD_V (ldap_pvt_thread_pool_t) connection_pool;
|
||||
LDAP_SLAPD_V (int) connection_pool_max;
|
||||
LDAP_SLAPD_V (int) slap_tool_thread_max;
|
||||
|
||||
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
|
||||
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;
|
||||
|
Loading…
Reference in New Issue
Block a user