]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Update maximum number or parameters for backend
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 17 Mar 2017 14:29:38 +0000 (14:29 +0000)
committerOndřej Kuzník <okuznik@symas.com>
Tue, 17 Nov 2020 17:42:44 +0000 (17:42 +0000)
servers/lloadd/backend.c
servers/lloadd/client.c
servers/lloadd/config.c
servers/lloadd/connection.c
servers/lloadd/slap.h
servers/lloadd/upstream.c

index 17d0ec51dfd051b60da8fa1442ba6aaf60656db9..53fbd414599e75fff603e1e208195ad32cd3b20b 100644 (file)
@@ -87,7 +87,7 @@ backend_select( Operation *op )
         ldap_pvt_thread_mutex_lock( &b->b_lock );
         c = b->b_conns;
         ldap_pvt_thread_mutex_lock( &c->c_mutex );
-        if ( c->c_struct_state != SLAP_C_UNINITIALIZED && !c->c_pendingber ) {
+        if ( c->c_state == SLAP_C_READY && !c->c_pendingber ) {
             ldap_pvt_thread_mutex_unlock( &b->b_lock );
             return b->b_conns;
         }
index c1d94fcbfab1c06beb79481eb77c258765cf7faa..c8c41cb79e534249220b5499927daddb80e95604 100644 (file)
@@ -130,6 +130,8 @@ client_init(
 
     c = connection_init( s, peername, flags );
 
+    c->c_state = SLAP_C_READY;
+
     event = event_new( base, s, EV_READ|EV_PERSIST, client_read_cb, c );
     if ( !event ) {
         Debug( LDAP_DEBUG_ANY, "Read event could not be allocated\n" );
@@ -159,7 +161,7 @@ fail:
         event_del( c->c_read_event );
         event_free( c->c_read_event );
     }
-    c->c_struct_state = SLAP_C_UNINITIALIZED;
+    c->c_state = SLAP_C_INVALID;
     connection_destroy( c );
     return NULL;
 }
@@ -173,6 +175,6 @@ client_destroy( Connection *c )
     event_del( c->c_write_event );
     event_free( c->c_write_event );
 
-    c->c_struct_state = SLAP_C_UNINITIALIZED;
+    c->c_state = SLAP_C_INVALID;
     connection_destroy( c );
 }
index d464ffba523d17ec34837a559bcc4d6d256bdf67..9b6e82fd9a861cd53bae20cc8e0e9158d53748e3 100644 (file)
@@ -154,7 +154,7 @@ static ConfigTable config_back_cf_table[] = {
         ARG_INT|ARG_MAGIC|CFG_CONCUR,
         &config_generic,
     },
-    { "backend", "type", 2, 2, 0,
+    { "backend", "type", 2, 0, 0,
         ARG_MAGIC|CFG_DATABASE,
         &config_backend,
     },
index f86cce3f12d85f4610101dbaac9f2970f1e93a7d..e270bdc0bc07a04c88c309a14b0158c5c279154d 100644 (file)
@@ -58,7 +58,7 @@ connection_destroy( Connection *c )
             "destroying connection %lu.\n",
             c->c_connid );
 
-    assert( c->c_struct_state == SLAP_C_UNINITIALIZED );
+    assert( c->c_state == SLAP_C_INVALID );
     ber_sockbuf_free( c->c_sb );
 
     if ( c->c_currentber ) {
@@ -156,7 +156,7 @@ connection_init( ber_socket_t s, const char *peername, int flags )
             c->c_connid, s );
 
     ldap_pvt_thread_mutex_lock( &c->c_mutex );
-    c->c_struct_state = SLAP_C_USED;
+    c->c_state = SLAP_C_ACTIVE;
 
     return c;
 }
index 27cfc4b17afbae6e2a7deae7c117657994d715a1..5925f55edc268c82fcd5e4c74202261c4a1cc006 100644 (file)
@@ -243,29 +243,19 @@ struct Backend {
     LDAP_STAILQ_ENTRY(Backend) b_next;
 };
 
-/*
- * represents a connection from an ldap client
- */
-/* structure state (protected by connections_mutex) */
-enum sc_struct_state {
-    SLAP_C_UNINITIALIZED = 0, /* MUST BE ZERO (0) */
-    SLAP_C_UNUSED,
-    SLAP_C_USED,
-    SLAP_C_PENDING
-};
-
 /* connection state (protected by c_mutex) */
-enum sc_conn_state {
+enum sc_state {
     SLAP_C_INVALID = 0, /* MUST BE ZERO (0) */
-    SLAP_C_INACTIVE,    /* zero threads */
+    SLAP_C_READY,       /* ready */
     SLAP_C_CLOSING,     /* closing */
-    SLAP_C_ACTIVE,      /* one or more threads */
+    SLAP_C_ACTIVE,      /* exclusive operation (tls setup, ...) in progress */
     SLAP_C_BINDING,     /* binding */
-    SLAP_C_CLIENT       /* outbound client conn */
 };
+/*
+ * represents a connection from an ldap client/to ldap server
+ */
 struct Connection {
-    enum sc_struct_state c_struct_state; /* structure management state */
-    enum sc_conn_state c_conn_state;     /* connection state */
+    enum sc_state c_state; /* connection state */
     ber_socket_t c_fd;
 
     ldap_pvt_thread_mutex_t c_mutex; /* protect the connection */
index 4d87ee5fc593f2f1bc83439844a68fbf6267da5c..bdc62acfabcf6c3fd24c77abd46134ee7dcca26c 100644 (file)
@@ -194,6 +194,8 @@ upstream_init( ber_socket_t s, Backend *backend )
     c->c_write_event = event;
 
     c->c_private = backend;
+
+    c->c_state = SLAP_C_READY;
     ldap_pvt_thread_mutex_unlock( &c->c_mutex );
 
     return c;
@@ -215,7 +217,7 @@ upstream_destroy( Connection *c )
 {
     Backend *b = c->c_private;
 
-    c->c_struct_state = SLAP_C_UNINITIALIZED;
+    c->c_state = SLAP_C_INVALID;
     ldap_pvt_thread_mutex_unlock( &c->c_mutex );
 
     ldap_pvt_thread_mutex_lock( &b->b_lock );