[asterisk-dev] res_config_ldap retry logic
Matthew McAughan
matt.mcaughan at gmail.com
Fri Dec 12 15:29:37 CST 2008
Anyone familiar with the res_config_ldap code know why this particular ldap
call, and not every ldap call, is wrapped in retry logic that relates to the
connection status. It's almost as if someone encountered connection errors
and instead of solving opted to live with them. Wanted and insight behind
this while I dig in and try to solve it. Because it happens to us
occasionally and might be the cause of other errors we are seeing.
do {
/* freeing ldap_result further down */
result = ldap_search_ext_s(ldapConn, clean_basedn,
LDAP_SCOPE_SUBTREE, filter, NULL, 0, NULL, NULL, NULL,
LDAP_NO_LIMIT,
&ldap_result);
if (result < 0 && is_ldap_connect_error(result)) {
ast_log(LOG_WARNING, "Failed to query database. Try %d/3\n",
tries + 1);
tries++;
if (tries < 3) {
usleep(500000L * tries);
if (ldapConn) {
ldap_unbind_ext_s(ldapConn,NULL,NULL);
ldapConn = NULL;
}
if (!ldap_reconnect())
break;
}
}
} while (result < 0 && tries < 3 && is_ldap_connect_error(result));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20081212/a7611ecf/attachment.htm
More information about the asterisk-dev
mailing list