}
- 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);
- }
+ &total_hits, &approx_hits, show_records_ready, c);
+ if (!rl)
+ return;
response_open(c, "show");
wrbuf_printf(c->wrbuf, "\n<activeclients>%d</activeclients>\n", active);
struct record_cluster **show_range_start(struct session *se,
struct reclist_sortparms *sp,
int start, int *num, int *total,
- Odr_int *sumhits, Odr_int *approx_hits)
+ Odr_int *sumhits, Odr_int *approx_hits,
+ void (*show_records_ready)(void *data),
+ struct http_channel *chan)
{
struct record_cluster **recs = 0;
struct reclist_sortparms *spp;
struct client_list *l;
+ int num0 = *num;
int i;
#if USE_TIMING
yaz_timing_t t = yaz_timing_create();
yaz_timing_get_sys(t));
yaz_timing_destroy(&t);
#endif
+ if (*num < num0)
+ {
+ session_log(se, YLOG_LOG,
+ "Subset %d < %d retrieved for show", *num, num0);
+ if (!session_fetch_more(se))
+ session_log(se, YLOG_LOG, "can not fetch more");
+ else
+ {
+ show_range_stop(se, recs);
+ session_log(se, YLOG_LOG, "fetching more in progress");
+ if (session_set_watch(se, SESSION_WATCH_SHOW,
+ show_records_ready, chan, chan))
+ {
+ session_log(se, YLOG_WARN, "Ignoring show block");
+ session_enter(se, "show_range_start");
+ }
+ else
+ {
+ session_log(se, YLOG_LOG, "session watch OK");
+ return 0;
+ }
+ }
+ }
return recs;
}
int start,
int *num, int *total,
Odr_int *sumhits,
- Odr_int *approximation);
-
+ Odr_int *approximation,
+ void (*ready)(void *data),
+ struct http_channel *chan);
int session_fetch_more(struct session *s);
void show_range_stop(struct session *s, struct record_cluster **recs);