From f4ebbe4de40e8177ca55a36e9dd77152808a9447 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 7 Feb 2013 12:42:01 +0100 Subject: [PATCH] Fix hang of record with esn/syntax (2nd) Command record with esn and/or syntax makes a definite retrieval. If that hits a cached record it would not see record events from ZOOM and handle those. This commit ensures that connection_continue calls event handling function non_block_events if necessary. Since the session is already locked in some cases, we must ensure that non_block_events do not (again) block on session. --- src/client.c | 3 ++- src/client.h | 2 +- src/connection.c | 18 ++---------------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/client.c b/src/client.c index 0cf2e07..ee6ead2 100644 --- a/src/client.c +++ b/src/client.c @@ -645,7 +645,7 @@ static void client_record_ingest(struct client *cl) } } -void client_record_response(struct client *cl) +void client_record_response(struct client *cl, int *got_records) { struct connection *co = cl->connection; ZOOM_connection link = connection_get_link(co); @@ -678,6 +678,7 @@ void client_record_response(struct client *cl) else { client_record_ingest(cl); + *got_records = 1; } } } diff --git a/src/client.h b/src/client.h index 8176db9..bb66d60 100644 --- a/src/client.h +++ b/src/client.h @@ -63,7 +63,7 @@ const char *client_get_pquery(struct client *cl); void client_init_response(struct client *cl, Z_APDU *a); void client_search_response(struct client *cl); -void client_record_response(struct client *cl); +void client_record_response(struct client *cl, int *got_records); void client_close_response(struct client *cl, Z_APDU *a); int client_is_our_response(struct client *cl); diff --git a/src/connection.c b/src/connection.c index 9ca2142..a87d14c 100644 --- a/src/connection.c +++ b/src/connection.c @@ -257,8 +257,7 @@ static void non_block_events(struct connection *co) client_search_response(cl); break; case ZOOM_EVENT_RECV_RECORD: - client_record_response(cl); - got_records = 1; + client_record_response(cl, &got_records); break; default: yaz_log(YLOG_LOG, "Unhandled event (%d) from %s", @@ -281,20 +280,7 @@ void connection_continue(struct connection *co) { int r = ZOOM_connection_exec_task(co->link); if (!r) - { - const char *error, *addinfo; - int err; - if ((err = ZOOM_connection_error(co->link, &error, &addinfo))) - { - if (co->client) - { - yaz_log(YLOG_LOG, "Error %s from %s", - error, client_get_id(co->client)); - client_set_diagnostic(co->client, err, error, addinfo); - client_set_state_nb(co->client, Client_Error); - } - } - } + non_block_events(co); else { iochan_setflags(co->iochan, ZOOM_connection_get_mask(co->link)); -- 1.7.10.4