Configuration part for retry timeouts

This commit is contained in:
Ondřej Kuzník 2017-04-12 15:57:21 +01:00 committed by Ondřej Kuzník
parent 673513a017
commit dc5e2538ec
3 changed files with 16 additions and 1 deletions

View File

@ -508,6 +508,15 @@ config_backend( ConfigArgs *c )
goto done; goto done;
} }
if ( b->b_retry_timeout < 0 ) {
Debug( LDAP_DEBUG_ANY, "config_backend: "
"invalid retry timeout configuration\n" );
rc = -1;
goto done;
}
b->b_retry_tv.tv_sec = b->b_retry_timeout / 1000;
b->b_retry_tv.tv_usec = ( b->b_retry_timeout % 1000 ) * 1000;
if ( BER_BVISNULL( &b->b_bindconf.sb_uri ) ) { if ( BER_BVISNULL( &b->b_bindconf.sb_uri ) ) {
Debug( LDAP_DEBUG_ANY, "config_backend: " Debug( LDAP_DEBUG_ANY, "config_backend: "
"backend address not specified\n" ); "backend address not specified\n" );
@ -1907,6 +1916,7 @@ static slap_cf_aux_table bindkey[] = {
{ BER_BVC("numconns="), offsetof(Backend, b_numconns), 'i', 0, NULL }, { BER_BVC("numconns="), offsetof(Backend, b_numconns), 'i', 0, NULL },
{ BER_BVC("bindconns="), offsetof(Backend, b_numbindconns), 'i', 0, NULL }, { BER_BVC("bindconns="), offsetof(Backend, b_numbindconns), 'i', 0, NULL },
{ BER_BVC("retry="), offsetof(Backend, b_retry_timeout), 'i', 0, NULL },
#ifdef HAVE_TLS #ifdef HAVE_TLS
{ BER_BVC("starttls="), offsetof(Backend, b_bindconf.sb_tls), 'i', 0, tlskey }, { BER_BVC("starttls="), offsetof(Backend, b_bindconf.sb_tls), 'i', 0, tlskey },
{ BER_BVC("tls_cert="), offsetof(Backend, b_bindconf.sb_tls_cert), 's', 1, NULL }, { BER_BVC("tls_cert="), offsetof(Backend, b_bindconf.sb_tls_cert), 's', 1, NULL },

View File

@ -247,6 +247,10 @@ struct Backend {
enum lload_tls_type b_tls; enum lload_tls_type b_tls;
char *b_host; char *b_host;
int b_retry_timeout, b_failed;
struct event *b_retry_event;
struct timeval b_retry_tv;
int b_numconns, b_numbindconns; int b_numconns, b_numbindconns;
int b_bindavail, b_active, b_opening; int b_bindavail, b_active, b_opening;
LDAP_LIST_HEAD(ConnSt, Connection) b_conns, b_bindconns; LDAP_LIST_HEAD(ConnSt, Connection) b_conns, b_bindconns;

View File

@ -813,7 +813,8 @@ upstream_destroy( Connection *c )
{ {
Backend *b = c->c_private; Backend *b = c->c_private;
Debug( LDAP_DEBUG_CONNS, "upstream_destroy: freeing connection %lu\n", Debug( LDAP_DEBUG_CONNS, "upstream_destroy: "
"freeing connection %lu\n",
c->c_connid ); c->c_connid );
assert( c->c_state != SLAP_C_INVALID ); assert( c->c_state != SLAP_C_INVALID );