X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;f=src%2Fhttp_command.c;h=ecc12751e34a2cc6846dfad30b1028cb64c56709;hb=0198d9a410e2664e29f8fa526cf9bcf8f5bea89a;hp=d1af016c9da7fdbea609f5633ac18584badb9e9a;hpb=1df928b3ab324b955a24a9d537b3d05b4700ec2f;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index d1af016..ecc1275 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -1,5 +1,5 @@ /* This file is part of Pazpar2. - Copyright (C) 2006-2012 Index Data + Copyright (C) 2006-2013 Index Data Pazpar2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -93,6 +93,8 @@ struct http_sessions { static YAZ_MUTEX g_http_session_mutex = 0; static int g_http_sessions = 0; +static void show_records_ready(void *data); + int get_version(struct http_request *rq) { const char *version = http_argbyname(rq, "version"); int version_no = 0; @@ -1118,7 +1120,31 @@ static void show_records(struct http_channel *c, struct http_session *s, int act } - rl = show_range_start(s->psession, sp, startn, &numn, &total, &total_hits, &approx_hits); + i = numn; + rl = show_range_start(s->psession, sp, startn, &numn, &total, + &total_hits, &approx_hits); + if (i > numn) + { + show_range_stop(s->psession, rl); + session_log(s->psession, YLOG_LOG, + "Subset %d < %d retrieved for show", numn, i); + if (!session_fetch_more(s->psession)) + session_log(s->psession, YLOG_LOG, "can not fetch more"); + else + { + session_log(s->psession, YLOG_LOG, "fetching more in progress"); + if (session_set_watch(s->psession, SESSION_WATCH_SHOW, + show_records_ready, c, c)) + session_log(s->psession, YLOG_WARN, "Ignoring show block"); + else + { + session_log(s->psession, YLOG_LOG, "session watch OK"); + return; + } + } + rl = show_range_start(s->psession, sp, startn, &numn, &total, + &total_hits, &approx_hits); + } response_open(c, "show"); wrbuf_printf(c->wrbuf, "\n%d\n", active);