that session is not mutex locked if client is already active */
if (was_active && !client_is_active(cl) && cl->session)
{
+
int no_active = session_active_clients(cl->session);
+ yaz_log(YLOG_DEBUG, "%s: releasing watches on zero active: %d", client_get_url(cl), no_active);
if (no_active == 0) {
session_alert_watch(cl->session, SESSION_WATCH_SHOW);
session_alert_watch(cl->session, SESSION_WATCH_SHOW_PREF);
client_show_raw_dequeue(cl);
}
-static void client_check_preferred_watch(struct client *cl)
+void client_check_preferred_watch(struct client *cl)
{
struct session *se = cl->session;
+ yaz_log(YLOG_DEBUG, "client_check_preferred_watch: %s ", client_get_url(cl));
if (se)
{
client_unlock(cl);
- if (session_preferred_clients_ready(se))
+ if (session_is_preferred_clients_ready(se)) {
session_alert_watch(se, SESSION_WATCH_SHOW_PREF);
+ }
+ else
+ yaz_log(YLOG_DEBUG, "client_check_preferred_watch: Still locked on preferred targets.");
+
client_lock(cl);
}
+ else
+ yaz_log(YLOG_WARN, "client_check_preferred_watch: %s. No session!", client_get_url(cl));
+
}
void client_search_response(struct client *cl)
}
else
{
+ yaz_log(YLOG_DEBUG, "client_search_response: hits "
+ ODR_INT_PRINTF, cl->hits);
client_report_facets(cl, resultset);
cl->record_offset = cl->startrecs;
cl->hits = ZOOM_resultset_size(resultset);
- if (se)
+ if (se) {
se->total_hits += cl->hits;
- if (cl->preferred)
- client_check_preferred_watch(cl);
+ yaz_log(YLOG_DEBUG, "client_search_response: total hits "
+ ODR_INT_PRINTF, se->total_hits);
+ }
}
}
if (opt_preferred) {
cl->preferred = atoi(opt_preferred);
- yaz_log(YLOG_LOG, "Target %s has preferred: %d", sdb->database->url, cl->preferred);
+ if (cl->preferred)
+ yaz_log(YLOG_LOG, "Target %s has preferred status: %d", sdb->database->url, cl->preferred);
}
client_set_state(cl, Client_Working);