Commit 463bcdd2 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Ondřej Kuzník
Browse files

Update backend progress tracking

parent dc5e2538
...@@ -31,7 +31,6 @@ static void ...@@ -31,7 +31,6 @@ static void
upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg ) upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
{ {
Backend *b = arg; Backend *b = arg;
Connection *c;
ber_socket_t s = AC_SOCKET_INVALID; ber_socket_t s = AC_SOCKET_INVALID;
int rc; int rc;
...@@ -70,7 +69,11 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg ) ...@@ -70,7 +69,11 @@ upstream_name_cb( int result, struct evutil_addrinfo *res, void *arg )
goto fail; 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 ); ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b ); backend_retry( b );
return; return;
...@@ -80,6 +83,7 @@ fail: ...@@ -80,6 +83,7 @@ fail:
evutil_closesocket( s ); evutil_closesocket( s );
} }
b->b_opening--; b->b_opening--;
b->b_failed++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b ); backend_retry( b );
} }
...@@ -161,7 +165,6 @@ backend_connect( void *ctx, void *arg ) ...@@ -161,7 +165,6 @@ backend_connect( void *ctx, void *arg )
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_LOCAL
if ( b->b_proto == LDAP_PROTO_IPC ) { if ( b->b_proto == LDAP_PROTO_IPC ) {
struct sockaddr_un addr; struct sockaddr_un addr;
Connection *c;
ber_socket_t s = socket( PF_LOCAL, SOCK_STREAM, 0 ); ber_socket_t s = socket( PF_LOCAL, SOCK_STREAM, 0 );
int rc; int rc;
...@@ -190,7 +193,11 @@ backend_connect( void *ctx, void *arg ) ...@@ -190,7 +193,11 @@ backend_connect( void *ctx, void *arg )
goto fail; 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 ); ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b ); backend_retry( b );
return NULL; return NULL;
...@@ -210,6 +217,7 @@ backend_connect( void *ctx, void *arg ) ...@@ -210,6 +217,7 @@ backend_connect( void *ctx, void *arg )
fail: fail:
b->b_opening--; b->b_opening--;
b->b_failed++;
ldap_pvt_thread_mutex_unlock( &b->b_mutex ); ldap_pvt_thread_mutex_unlock( &b->b_mutex );
backend_retry( b ); backend_retry( b );
return (void *)-1; return (void *)-1;
......
...@@ -748,8 +748,6 @@ upstream_init( ber_socket_t s, Backend *b ) ...@@ -748,8 +748,6 @@ upstream_init( ber_socket_t s, Backend *b )
assert( b != NULL ); assert( b != NULL );
b->b_opening--;
flags = (b->b_tls == LLOAD_LDAPS) ? CONN_IS_TLS : 0; flags = (b->b_tls == LLOAD_LDAPS) ? CONN_IS_TLS : 0;
c = connection_init( s, b->b_host, flags ); c = connection_init( s, b->b_host, flags );
c->c_private = b; c->c_private = b;
......
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