]> git.sur5r.net Git - openldap/commitdiff
better handling of bind retry
authorPierangelo Masarati <ando@openldap.org>
Wed, 17 Aug 2005 08:17:30 +0000 (08:17 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 17 Aug 2005 08:17:30 +0000 (08:17 +0000)
tests/progs/slapd-addel.c
tests/progs/slapd-modify.c
tests/progs/slapd-modrdn.c
tests/progs/slapd-read.c
tests/progs/slapd-search.c

index c96cdccd3528ba2db1f464dff1fba86f36ea58ea..6b8caacc0633293494a111f4bcaf02a67e9baba7 100644 (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 );
        }
index 37e45ec19e339ff26a0639697877782caa0f8f60..b639df553908dd065281e8020b2e37334780b25a 100644 (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 );
        }
index 60e85fa77b839f16df3998f1b75ef35784ee9dd7..2e95ddfa038e126f7ee1319f9d897d02f069da08 100644 (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 );
        }
index c3c09758b5e6057e03adf611fc2d0b002f1f30a1..e2c07686794808b4508b2580f3c2349e9e03d1e4 100644 (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 );
        }
index de42211fca1ef8a8ee28ad3f44f0ff69f166a260..25488b816c3389d4bf12d1fae98c70fb62503afd 100644 (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 );
        }