From: Dennis Schafroth Date: Fri, 3 Sep 2010 11:31:47 +0000 (+0200) Subject: Add more debugging around watch. Rename and to header. X-Git-Tag: v1.5.0~22 X-Git-Url: http://sru.miketaylor.org.uk/?a=commitdiff_plain;h=bc20cb564f2bd34cf9a9edab89e8024bbe5794df;p=pazpar2-moved-to-github.git Add more debugging around watch. Rename and to header. --- diff --git a/src/client.c b/src/client.c index bb5ee3a..a931ca8 100644 --- a/src/client.c +++ b/src/client.c @@ -147,7 +147,9 @@ void client_set_state(struct client *cl, enum client_state st) 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); @@ -447,14 +449,22 @@ static void ingest_raw_record(struct client *cl, ZOOM_record rec) static void client_check_preferred_watch(struct client *cl) { + yaz_log(YLOG_DEBUG, "client_check_preferred_watch: %s ", client_get_url(cl)); struct session *se = cl->session; 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: %s ", client_get_url(cl)); + 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) diff --git a/src/client.h b/src/client.h index b550129..70ba6d1 100644 --- a/src/client.h +++ b/src/client.h @@ -77,6 +77,7 @@ int client_prep_connection(struct client *cl, void client_start_search(struct client *cl); void client_set_session(struct client *cl, struct session *se); int client_is_active(struct client *cl); +int client_is_active_preferred(struct client *cl); struct client *client_next_in_session(struct client *cl); int client_parse_query(struct client *cl, const char *query);