ODR odr, BackendPtr b,
Odr_oid *preferredRecordSyntax,
const char *element_set_name);
-
+ bool retry(mp::Package &package,
+ mp::odr &odr,
+ BackendPtr b,
+ int &error, char **addinfo,
+ int &proxy_step, int &same_retries,
+ int &proxy_retries);
void log_diagnostic(mp::Package &package,
int error, const char *addinfo);
public:
private:
void configure_local_records(const xmlNode * ptr, bool test_only);
bool check_proxy(const char *proxy);
+
+
+
FrontendPtr get_frontend(mp::Package &package);
void release_frontend(mp::Package &package);
SearchablePtr parse_torus_record(const xmlNode *ptr);
return outcome;
}
+bool yf::Zoom::Frontend::retry(mp::Package &package,
+ mp::odr &odr,
+ BackendPtr b,
+ int &error, char **addinfo,
+ int &proxy_step, int &same_retries,
+ int &proxy_retries)
+{
+ if (b && b->m_proxy.length() && !m_p->check_proxy(b->m_proxy.c_str()))
+ {
+ log_diagnostic(package, error, *addinfo);
+ package.log("zoom", YLOG_LOG, "proxy %s fails", b->m_proxy.c_str());
+ m_backend.reset();
+ if (proxy_step) // there is a failover
+ {
+ proxy_retries++;
+ package.log("zoom", YLOG_WARN, "search failed: trying next proxy");
+ return true;
+ }
+ error = YAZ_BIB1_INIT_AC_AUTHENTICATION_SYSTEM_ERROR;
+ *addinfo = odr_strdup(odr, "proxy failure");
+ }
+ else if (same_retries == 0 && proxy_retries == 0)
+ {
+ log_diagnostic(package, error, *addinfo);
+ same_retries++;
+ package.log("zoom", YLOG_WARN, "search failed: retry");
+ m_backend.reset();
+ proxy_step = 0;
+ return true;
+ }
+ return false;
+}
+
void yf::Zoom::Frontend::handle_search(mp::Package &package)
{
Z_GDU *gdu = package.request().get();
&addinfo, odr, &proxy_step);
if (error)
{
- if (b && b->m_proxy.length() && !m_p->check_proxy(b->m_proxy.c_str()))
- {
- log_diagnostic(package, error, addinfo);
- package.log("zoom", YLOG_LOG, "proxy %s fails", b->m_proxy.c_str());
- m_backend.reset();
- if (proxy_step) // there is a failover
- {
- proxy_retries++;
- package.log("zoom", YLOG_WARN, "search failed: trying next proxy");
- goto next_proxy;
- }
- error = YAZ_BIB1_INIT_AC_AUTHENTICATION_SYSTEM_ERROR;
- addinfo = odr_strdup(odr, "proxy failure");
- }
- else if (same_retries == 0 && proxy_retries == 0)
- {
- log_diagnostic(package, error, addinfo);
- same_retries++;
- package.log("zoom", YLOG_WARN, "search failed: retry");
- m_backend.reset();
- proxy_step = 0;
+ if (retry(package, odr, b, error, &addinfo, proxy_step,
+ same_retries, proxy_retries))
goto next_proxy;
- }
}
if (error)
{
if (error)
{
- if (b->m_proxy.length() && !m_p->check_proxy(b->m_proxy.c_str()))
- {
- log_diagnostic(package, error, addinfo);
- package.log("zoom", YLOG_LOG, "proxy %s fails", b->m_proxy.c_str());
- m_backend.reset();
- if (proxy_step) // there is a failover
- {
- proxy_retries++;
- package.log("zoom", YLOG_WARN, "search failed: trying next proxy");
- goto next_proxy;
- }
- error = YAZ_BIB1_INIT_AC_AUTHENTICATION_SYSTEM_ERROR;
- addinfo = odr_strdup(odr, "proxy failure");
- }
- else if (same_retries == 0 && proxy_retries == 0)
- {
- log_diagnostic(package, error, addinfo);
- same_retries++;
- package.log("zoom", YLOG_WARN, "search failed: retry");
- m_backend.reset();
- proxy_step = 0;
+ if (retry(package, odr, b, error, &addinfo, proxy_step,
+ same_retries, proxy_retries))
goto next_proxy;
- }
}
const char *element_set_name = 0;