-/* $Id: pazpar2.c,v 1.12 2006-12-12 02:36:24 quinn Exp $ */;
+/* $Id: pazpar2.c,v 1.13 2006-12-14 14:58:03 quinn Exp $ */;
#include <stdlib.h>
#include <stdio.h>
if (len < 0)
{
- client_fatal(cl);
+ yaz_log(YLOG_WARN|YLOG_ERRNO, "Error reading from Z server");
+ connection_destroy(co);
return;
}
else if (len == 0)
{
- client_fatal(cl);
+ yaz_log(YLOG_WARN, "EOF reading from Z server");
+ connection_destroy(co);
return;
}
else if (len > 1) // We discard input if we have no connection
client_freelist = c;
}
+void session_set_watch(struct session *s, int what, session_watchfun fun, void *data)
+{
+ s->watchlist[what].fun = fun;
+ s->watchlist[what].data = data;
+}
+
// This should be extended with parameters to control selection criteria
// Associates a set of clients with a session;
int select_targets(struct session *se)
struct session *new_session()
{
+ int i;
struct session *session = xmalloc(sizeof(*session));
yaz_log(YLOG_DEBUG, "New pazpar2 session");
session->query[0] = '\0';
session->nmem = nmem_create();
session->wrbuf = wrbuf_alloc();
+ for (i = 0; i <= SESSION_WATCH_MAX; i++)
+ {
+ session->watchlist[i].data = 0;
+ session->watchlist[i].fun = 0;
+ }
select_targets(session);
struct client *next;
};
+#define SESSION_WATCH_RECORDS 0
+#define SESSION_WATCH_MAX 0
+
+typedef void (*session_watchfun)(void *data);
+
// End-user session
struct session {
struct client *clients;
struct termlist *termlist;
struct relevance *relevance;
struct reclist *reclist;
+ struct {
+ void *data;
+ session_watchfun fun;
+ } watchlist[SESSION_WATCH_MAX + 1];
int total_hits;
int total_records;
};
char *search(struct session *s, char *query);
struct record **show(struct session *s, int start, int *num, int *total, int *sumhits);
struct termlist_score **termlist(struct session *s, int *num);
+void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
#endif