From: Howard Chu Date: Fri, 1 Oct 2004 12:00:41 +0000 (+0000) Subject: Add a retry for failed connections X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~474 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bbe986b94e7ecc868fac145bcc06694dbfaf5d81;p=openldap Add a retry for failed connections --- diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index 95a3f26500..91de42d173 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -553,6 +553,7 @@ ldap_back_exop_whoami( LDAPMessage *res; Operation op2 = *op; ber_int_t msgid; + int do_retry = 1; ctrls[0] = &c; op2.o_ndn = op->o_conn->c_ndn; @@ -567,11 +568,17 @@ ldap_back_exop_whoami( strcpy(c.ldctl_value.bv_val, "dn:"); strcpy(c.ldctl_value.bv_val+3, op->o_ndn.bv_val); +retry: rs->sr_err = ldap_whoami(lc->ld, ctrls, NULL, &msgid); if (rs->sr_err == LDAP_SUCCESS) { if (ldap_result(lc->ld, msgid, 1, NULL, &res) == -1) { ldap_get_option(lc->ld, LDAP_OPT_ERROR_NUMBER, &rs->sr_err); + if ( rs->sr_err == LDAP_SERVER_DOWN && do_retry ) { + do_retry = 0; + if ( ldap_back_retry( lc, op, rs ) ) + goto retry; + } ldap_back_freeconn( op, lc ); lc = NULL;