The client and connection code now fires SESSION_WATCH_SHOW and
SESSION_WATCH_RECORD after all non-blocking events has been received
from some client. Previously this was done on first record received.
Fixes #3318.
+void client_got_records(struct client *cl)
+{
+ if (cl->session)
+ {
+ session_alert_watch(cl->session, SESSION_WATCH_SHOW);
+ session_alert_watch(cl->session, SESSION_WATCH_RECORD);
+ }
+}
+
void client_record_response(struct client *cl)
{
struct connection *co = cl->connection;
void client_record_response(struct client *cl)
{
struct connection *co = cl->connection;
if (ingest_record(cl, xmlrec, cl->record_offset, nmem))
yaz_log(YLOG_WARN, "Failed to ingest from %s",
client_get_url(cl));
if (ingest_record(cl, xmlrec, cl->record_offset, nmem))
yaz_log(YLOG_WARN, "Failed to ingest from %s",
client_get_url(cl));
- else
- {
- session_alert_watch(cl->session, SESSION_WATCH_SHOW);
- session_alert_watch(cl->session, SESSION_WATCH_RECORD);
- }
void client_set_startrecs(struct client *cl, int v);
void client_remove_from_session(struct client *c);
void client_incref(struct client *c);
void client_set_startrecs(struct client *cl, int v);
void client_remove_from_session(struct client *c);
void client_incref(struct client *c);
+void client_got_records(struct client *c);
static void non_block_events(struct connection *co)
{
static void non_block_events(struct connection *co)
{
IOCHAN iochan = co->iochan;
ZOOM_connection link = co->link;
while (1)
IOCHAN iochan = co->iochan;
ZOOM_connection link = co->link;
while (1)
break;
case ZOOM_EVENT_RECV_RECORD:
client_record_response(cl);
break;
case ZOOM_EVENT_RECV_RECORD:
client_record_response(cl);
break;
default:
yaz_log(YLOG_LOG, "Unhandled event (%d) from %s",
break;
default:
yaz_log(YLOG_LOG, "Unhandled event (%d) from %s",
+ if (got_records)
+ {
+ struct client *cl = co->client;
+ if (cl)
+ {
+ client_incref(cl);
+ client_got_records(cl);
+ client_destroy(cl);
+ }
+ }
}
void connection_continue(struct connection *co)
}
void connection_continue(struct connection *co)