Commit 5bdb4e15 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Ondřej Kuzník
Browse files

Update maximum number or parameters for backend

parent fd5b9cdb
......@@ -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;
}
......
......@@ -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 );
}
......@@ -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,
},
......
......@@ -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;
}
......@@ -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 */
......
......@@ -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 );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment