From bbe986b94e7ecc868fac145bcc06694dbfaf5d81 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 1 Oct 2004 12:00:41 +0000 Subject: [PATCH] Add a retry for failed connections --- servers/slapd/back-ldap/config.c | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.39.5