]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Configuration part for retry timeouts
authorOndřej Kuzník <ondra@mistotebe.net>
Wed, 12 Apr 2017 14:57:21 +0000 (15:57 +0100)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:55:46 +0000 (17:55 +0000)
servers/lloadd/config.c
servers/lloadd/slap.h
servers/lloadd/upstream.c

index 84e1ba92d976509253e2398a54bd21f1cbd0bf91..531e2196d9e5de7288e6d1673bfe4e23d148cde7 100644 (file)
@@ -508,6 +508,15 @@ config_backend( ConfigArgs *c )
         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 ) ) {
         Debug( LDAP_DEBUG_ANY, "config_backend: "
                 "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("bindconns="), offsetof(Backend, b_numbindconns), 'i', 0, NULL },
+    { BER_BVC("retry="), offsetof(Backend, b_retry_timeout), 'i', 0, NULL },
 #ifdef HAVE_TLS
     { 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 },
index 1ae43d3df241dafa1b7888f093e90a3095c8afc2..8ff91a938ce18f77809dc3d81a48993a59028c20 100644 (file)
@@ -247,6 +247,10 @@ struct Backend {
     enum lload_tls_type b_tls;
     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_bindavail, b_active, b_opening;
     LDAP_LIST_HEAD(ConnSt, Connection) b_conns, b_bindconns;
index b11afca2ca5d08848674a4fb49d0cff6a6239816..eb5291f3e291c7f7b1d87ea7106551458363444f 100644 (file)
@@ -813,7 +813,8 @@ upstream_destroy( Connection *c )
 {
     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 );
 
     assert( c->c_state != SLAP_C_INVALID );