Update backend progress tracking

This commit is contained in:
Ondřej Kuzník 2017-04-12 16:00:52 +01:00 committed by Ondřej Kuzník
parent dc5e2538ec
commit 463bcdd2c4
2 changed files with 12 additions and 6 deletions

View File

@ -31,7 +31,6 @@ static void
upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
{
Backend *b = arg;
Connection *c;
ber_socket_t s = AC_SOCKET_INVALID;
int rc;
@ -70,7 +69,11 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
goto fail;
}
c = upstream_init( s, b );
if ( !upstream_init( s, b ) ) {
goto fail;
}
b->b_opening--;
b->b_failed = 0;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b );
return;
@ -80,6 +83,7 @@ fail:
evutil_closesocket( s );
}
b->b_opening--;
b->b_failed++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b );
}
@ -161,7 +165,6 @@ backend_connect( void *ctx, void *arg )
#ifdef LDAP_PF_LOCAL
if ( b->b_proto == LDAP_PROTO_IPC ) {
struct sockaddr_un addr;
Connection *c;
ber_socket_t s = socket( PF_LOCAL, SOCK_STREAM, 0 );
int rc;
@ -190,7 +193,11 @@ backend_connect( void *ctx, void *arg )
goto fail;
}
c = upstream_init( s, b );
if ( !upstream_init( s, b ) ) {
goto fail;
}
b->b_opening--;
b->b_failed = 0;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b );
return NULL;
@ -210,6 +217,7 @@ backend_connect( void *ctx, void *arg )
fail:
b->b_opening--;
b->b_failed++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b );
return (void *)-1;

View File

@ -748,8 +748,6 @@ upstream_init( ber_socket_t s, Backend *b )
assert( b != NULL );
b->b_opening--;
flags = (b->b_tls == LLOAD_LDAPS) ? CONN_IS_TLS : 0;
c = connection_init( s, b->b_host, flags );
c->c_private = b;