X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fclient.c;h=064754a59b347879bdc980e022a1aa9eff1c8dc6;hb=3d39722ae64c21a6d5833ec667ef9fd2fb66913f;hp=a9f2406a1e6fc4c82826b9a65ec4f0fc48280af2;hpb=4a6689b7683d1dec50e1c45c050fc90990ec4794;p=pazpar2-moved-to-github.git diff --git a/src/client.c b/src/client.c index a9f2406..064754a 100644 --- a/src/client.c +++ b/src/client.c @@ -24,7 +24,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #if HAVE_CONFIG_H #include #endif -#include #include #include #include @@ -79,7 +78,7 @@ static void client_use(int delta) yaz_mutex_enter(g_mutex); no_clients += delta; yaz_mutex_leave(g_mutex); - yaz_log(YLOG_LOG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients); + yaz_log(YLOG_DEBUG, "%s clients=%d", delta > 0 ? "INC" : "DEC", no_clients); } #else #define client_use(x) @@ -439,10 +438,13 @@ void client_search_response(struct client *cl) void client_got_records(struct client *cl) { - if (cl->session) + struct session *se = cl->session; + if (se) { - session_alert_watch(cl->session, SESSION_WATCH_SHOW); - session_alert_watch(cl->session, SESSION_WATCH_RECORD); + client_unlock(cl); + session_alert_watch(se, SESSION_WATCH_SHOW); + session_alert_watch(se, SESSION_WATCH_RECORD); + client_lock(cl); } } @@ -623,10 +625,20 @@ struct client *client_create(void) return r; } +void client_lock(struct client *c) +{ + yaz_mutex_enter(c->mutex); +} + +void client_unlock(struct client *c) +{ + yaz_mutex_leave(c->mutex); +} + void client_incref(struct client *c) { pazpar2_incref(&c->ref_count, c->mutex); - yaz_log(YLOG_LOG, "client_incref c=%p %s cnt=%d", + yaz_log(YLOG_DEBUG, "client_incref c=%p %s cnt=%d", c, client_get_url(c), c->ref_count); } @@ -634,7 +646,7 @@ int client_destroy(struct client *c) { if (c) { - yaz_log(YLOG_LOG, "client_destroy c=%p %s cnt=%d", + yaz_log(YLOG_DEBUG, "client_destroy c=%p %s cnt=%d", c, client_get_url(c), c->ref_count); if (!pazpar2_decref(&c->ref_count, c->mutex)) {