]> git.sur5r.net Git - openldap/commitdiff
Fix ITS#3537 (need to repeat this fix for the other operations too.)
authorHoward Chu <hyc@openldap.org>
Fri, 4 Mar 2005 06:20:37 +0000 (06:20 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 4 Mar 2005 06:20:37 +0000 (06:20 +0000)
servers/slapd/back-ldap/search.c

index a9fc57fb752cc312e0cad3065415c021f822c207..9afcbafef46508a6815525bab98c0ea3bc0653de 100644 (file)
@@ -56,7 +56,6 @@ ldap_back_search(
        int             i;
        char            **attrs = NULL;
        int             dontfreetext = 0;
-       int             freeconn = 0;
        int             do_retry = 1;
        LDAPControl     **ctrls = NULL;
 
@@ -120,12 +119,18 @@ retry:
 
        if ( rs->sr_err != LDAP_SUCCESS ) {
 fail:;
-               rc = ldap_back_op_result( lc, op, rs, msgid, LDAP_BACK_SENDERR );
-               if ( freeconn ) {
+               if ( rs->sr_err == LDAP_SERVER_DOWN ) {
+                       if ( do_retry ) {
+                               do_retry = 0;
+                               if ( ldap_back_retry( lc, op, &rs, LDAP_BACK_DONTSEND ) ) {
+                                       goto retry;
+                               }
+                       }
+                       rc = ldap_back_op_result( lc, op, rs, msgid, LDAP_BACK_SENDERR );
                        ldap_back_freeconn( op, lc );
                        lc = NULL;
+                       goto finish;
                }
-               goto finish;
        }
 
        /* We pull apart the ber result, stuff it into a slapd entry, and
@@ -274,9 +279,7 @@ fail:;
                                goto retry;
                        }
                }
-               /* FIXME: invalidate the connection? */
                rs->sr_err = LDAP_SERVER_DOWN;
-               freeconn = 1;
                goto fail;
        }