Set up connections in the worker threads

This commit is contained in:
Ondřej Kuzník 2017-03-16 12:14:22 +00:00 committed by Ondřej Kuzník
parent bf66b48fe3
commit 79f7e79f15
4 changed files with 6 additions and 6 deletions

View File

@ -99,9 +99,10 @@ backend_select( Operation *op )
}
void *
backend_connect( Backend *b )
backend_connect( void *ctx, void *arg )
{
struct evutil_addrinfo hints = {};
Backend *b = arg;
#ifdef LDAP_PF_LOCAL
if ( b->b_proto == LDAP_PROTO_IPC ) {

View File

@ -1300,10 +1300,7 @@ slapd_daemon( struct event_base *daemon_base )
}
LDAP_STAILQ_FOREACH ( b, &backend, b_next ) {
rc = backend_connect( b );
if ( rc ) {
return rc;
}
ldap_pvt_thread_pool_submit( &connection_pool, backend_connect, b );
}
lloadd_inited = 1;

View File

@ -40,7 +40,7 @@ struct config_reply_s; /* config.h */
* backend.c
*/
LDAP_SLAPD_F (int) backend_connect( Backend *b );
LDAP_SLAPD_F (void *) backend_connect( void *ctx, void *arg );
/*
* ch_malloc.c

View File

@ -102,6 +102,8 @@ upstream_destroy( Connection *c )
b->b_conns = NULL;
ldap_pvt_thread_mutex_unlock( &b->b_lock );
ldap_pvt_thread_pool_submit( &connection_pool, backend_connect, b );
ldap_pvt_thread_mutex_lock( &c->c_mutex );
event_del( c->c_read_event );