X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=pazpar2.c;h=55dabb2302e9e4b021ccb5539acdcbb5ccef260d;hb=f7fb437044f32ea7e85a114414f32b170ab0ebb0;hp=f953a7dc6b604f65da96c38adc1f7868e3ea8131;hpb=ecfbf76a7a6c560d2e7dcd107450ff58a7d316e5;p=pazpar2-moved-to-github.git diff --git a/pazpar2.c b/pazpar2.c index f953a7d..55dabb2 100644 --- a/pazpar2.c +++ b/pazpar2.c @@ -1,4 +1,4 @@ -/* $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 #include @@ -736,12 +736,14 @@ static void handler(IOCHAN i, int event) 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 @@ -1113,6 +1115,12 @@ void client_destroy(struct client *c) 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) @@ -1180,6 +1188,7 @@ void destroy_session(struct session *s) struct session *new_session() { + int i; struct session *session = xmalloc(sizeof(*session)); yaz_log(YLOG_DEBUG, "New pazpar2 session"); @@ -1193,6 +1202,11 @@ struct session *new_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);