better handling of bind retry

This commit is contained in:
Pierangelo Masarati 2005-08-17 08:17:30 +00:00
parent ecd99b83dd
commit 0d35dcf83a
5 changed files with 56 additions and 16 deletions

View File

@ -291,9 +291,17 @@ retry:;
rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
do_retry--;
goto retry;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry == 1 ) {
do_retry = 0;
sleep( 1 );
goto retry;
}
/* fallthru */
default:
break;
}
exit( EXIT_FAILURE );
}

View File

@ -185,9 +185,17 @@ retry:;
rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
do_retry--;
goto retry;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry == 1 ) {
do_retry = 0;
sleep( 1 );
goto retry;
}
/* fallthru */
default:
break;
}
exit( EXIT_FAILURE );
}

View File

@ -177,9 +177,17 @@ retry:;
rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
do_retry--;
goto retry;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry == 1 ) {
do_retry = 0;
sleep( 1 );
goto retry;
}
/* fallthru */
default:
break;
}
exit( EXIT_FAILURE );
}

View File

@ -140,9 +140,17 @@ retry:;
rc = ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
ldap_perror( ld, "ldap_bind" );
if ( rc == LDAP_BUSY && do_retry > 0 ) {
do_retry--;
goto retry;
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry == 1 ) {
do_retry = 0;
sleep( 1 );
goto retry;
}
/* fallthru */
default:
break;
}
exit( EXIT_FAILURE );
}

View File

@ -157,11 +157,19 @@ retry:;
rc = ldap_bind_s( ld, manager, passwd, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {
if ( rc == LDAP_BUSY && do_retry == 1 ) {
do_retry = 0;
goto retry;
}
ldap_perror( ld, "ldap_bind" );
switch ( rc ) {
case LDAP_BUSY:
case LDAP_UNAVAILABLE:
if ( do_retry == 1 ) {
do_retry = 0;
sleep( 1 );
goto retry;
}
/* fallthru */
default:
break;
}
exit( EXIT_FAILURE );
}