From: Kurt Zeilenga Date: Sat, 5 May 2001 07:29:21 +0000 (+0000) Subject: Add simple configure support for sockbuf max incoming X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1440 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4055077607c96ce6d11f5afae57ce0fd54ee1ad8;p=openldap Add simple configure support for sockbuf max incoming --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 16d1fc126c..761c970731 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -41,6 +41,8 @@ char *default_passwd_hash; char *default_search_base = NULL; char *default_search_nbase = NULL; +ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT; + char *slapd_pid_file = NULL; char *slapd_args_file = NULL; @@ -241,6 +243,43 @@ read_config( const char *fname ) ldap_pvt_thread_set_concurrency( c ); + /* set sockbuf max */ + } else if ( strcasecmp( cargv[0], "sockbuf_max_incoming" ) == 0 ) { + long max; + if ( cargc < 2 ) { +#ifdef NEW_LOGGING + LDAP_LOG(( "config", LDAP_LEVEL_CRIT, + "%s: line %d: missing max in \"sockbuf_max_incoming \" line.\n", + fname, lineno, max )); +#else + Debug( LDAP_DEBUG_ANY, + "%s: line %d: invalid max value (%ld) in " + "\"sockbuf_max_incoming \" line.\n", + fname, lineno, max ); +#endif + + return( 1 ); + } + + sockbuf_max_incoming = max; + /* default search base */ } else if ( strcasecmp( cargv[0], "defaultSearchBase" ) == 0 ) { if ( cargc < 2 ) { diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 56c4b1bfc0..fe26fee674 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -424,7 +424,7 @@ long connection_init( c->c_sb = ber_sockbuf_alloc( ); { - ber_len_t max = SLAP_MAX_INCOMING; + ber_len_t max = sockbuf_max_incoming; ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max ); } @@ -635,7 +635,7 @@ connection_destroy( Connection *c ) c->c_sb = ber_sockbuf_alloc( ); { - ber_len_t max = SLAP_MAX_INCOMING; + ber_len_t max = sockbuf_max_incoming; ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max ); } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index fb731da079..0fefcde257 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -792,6 +792,8 @@ LDAP_SLAPD_F (int) krbv4_ldap_auth(); /* * Other... */ +#define SLAP_SB_MAX_INCOMING_DEFAULT (1<<18 - 1) +LDAP_SLAPD_F (ber_len_t) sockbuf_max_incoming; LDAP_SLAPD_F (slap_mask_t) global_restrictops; LDAP_SLAPD_F (slap_mask_t) global_allows;